Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultErrorWriter(w http.ResponseWriter, r *http.Request, code int, err error)
- func DefaultServerAuthorizer(req *http.Request) (string, error)
- type Authorizer
- type Client
- type ClientOption
- type ClientOptions
- type ConnectAuthorizer
- type Dialer
- type ErrorWriter
- type Node
- type Server
- type ServerOption
- type ServerOptions
- type Session
Constants ¶
View Source
const ( Data messageType = iota + 1 Connect Error AddClient RemoveClient Pause Resume )
View Source
const ( PingWaitDuration = 60 * time.Second PingWriteInterval = 5 * time.Second MaxRead = 8192 HandshakeTimeOut = 10 * time.Second )
View Source
const (
MaxBuffer = 1 << 21
)
Variables ¶
View Source
var ( Token = "X-API-Tunnel-Token" ID = "X-API-Tunnel-ID" )
View Source
var DefaultClientAuthorizer = func(proto, address string) bool { return true }
View Source
var ErrMessageType = errors.New("invalid message type")
View Source
var PrintTunnelData bool
PrintTunnelData No tunnel logging by default
Functions ¶
func DefaultErrorWriter ¶
Types ¶
type Client ¶
func DialContext ¶
type ClientOption ¶
type ClientOption func(*ClientOptions)
func ClientAuthorizer ¶
func ClientAuthorizer(a ConnectAuthorizer) ClientOption
func ClientCredentials ¶
func ClientCredentials(id, token string) ClientOption
type ClientOptions ¶
type ClientOptions struct {
// contains filtered or unexported fields
}
type ConnectAuthorizer ¶
ConnectAuthorizer custom for authorization
type ErrorWriter ¶
type ServerOption ¶
type ServerOption func(*ServerOptions)
func ServerAuthorizer ¶
func ServerAuthorizer(a Authorizer) ServerOption
func ServerErrorWriter ¶
func ServerErrorWriter(e ErrorWriter) ServerOption
func ServerOnConnect ¶
func ServerOnConnect(f func(*Node) error) ServerOption
func ServerOnDisconnect ¶
func ServerOnDisconnect(f func(*Node) error) ServerOption
type ServerOptions ¶
type ServerOptions struct {
// contains filtered or unexported fields
}
type Session ¶
func NewClientSession ¶
func NewClientSession(auth ConnectAuthorizer, conn *websocket.Conn) *Session
func NewClientSessionWithDialer ¶
func NewClientSessionWithDialer(auth ConnectAuthorizer, conn *websocket.Conn, dialer Dialer) *Session
Click to show internal directories.
Click to hide internal directories.