2019-09-01 19:23:45 +00:00
|
|
|
package server
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/cbeuw/Cloak/internal/util"
|
|
|
|
"net"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Transport interface {
|
|
|
|
HasRecordLayer() bool
|
|
|
|
UnitReadFunc() func(net.Conn, []byte) (int, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type TLS struct{}
|
|
|
|
|
2019-09-02 13:04:52 +00:00
|
|
|
func (TLS) String() string { return "TLS" }
|
|
|
|
func (TLS) HasRecordLayer() bool { return true }
|
|
|
|
func (TLS) UnitReadFunc() func(net.Conn, []byte) (int, error) { return util.ReadTLS }
|
2019-09-01 19:23:45 +00:00
|
|
|
|
|
|
|
type WebSocket struct{}
|
|
|
|
|
2019-09-02 13:04:52 +00:00
|
|
|
func (WebSocket) String() string { return "WebSocket" }
|
|
|
|
func (WebSocket) HasRecordLayer() bool { return false }
|
|
|
|
func (WebSocket) UnitReadFunc() func(net.Conn, []byte) (int, error) { return util.ReadWebSocket }
|