Cloak/internal/server/transport.go
2019-09-02 14:04:52 +01:00

24 lines
742 B
Go

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{}
func (TLS) String() string { return "TLS" }
func (TLS) HasRecordLayer() bool { return true }
func (TLS) UnitReadFunc() func(net.Conn, []byte) (int, error) { return util.ReadTLS }
type WebSocket struct{}
func (WebSocket) String() string { return "WebSocket" }
func (WebSocket) HasRecordLayer() bool { return false }
func (WebSocket) UnitReadFunc() func(net.Conn, []byte) (int, error) { return util.ReadWebSocket }