Documentation ¶
Index ¶
Constants ¶
const ( DefaultReadBufferSize = 64 * 1024 DefaultWriteBufferSize = 64 * 1024 )
Default buffer sizes for sniproxy.
Variables ¶
This section is empty.
Functions ¶
func IsClosedConnError ¶
IsClosedConnError checks if the error is a Closed connection error.
Types ¶
type DialOption ¶
type DialOption struct { // Path is the path of the WebSocket endpoint. Path string // Dialer is an optional WebSocket dialer to use. Dialer *websocket.Dialer // TunnelOptions fine tunes the behavior of a tunnel. TunnelOptions *Options // WithoutTLS uses the "ws://" scheme rather than the "wss://" scheme. WithoutTLS bool }
DialOption provides addition option for dialing.
type Endpoint ¶
type Endpoint struct {
// contains filtered or unexported fields
}
Endpoint is an endpoint that implements the listener.
type Options ¶
type Options struct { // Using a new websocket connection for each new incoming // new connection. Siding bool `json:",omitempty"` // Remote enables sending remote address. DialWithAddr bool `json:",omitempty"` }
Options is a the JSON marshalable options for dialing an endpoint.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an SNI based TCP proxy server that can serve over websocket.
func NewServer ¶
func NewServer(config *ServerConfig) *Server
NewServer creates a new server that can accept endpoint providing websocket connections.
func (*Server) ServeBack ¶
ServeBack serves an incoming proxy connection via websocket. It uses c.User as the endpoint name
func (*Server) ServeBackName ¶
ServeBackName serves an incoming proxy connection via websocket using the given endpoint name.
type ServerConfig ¶
type ServerConfig struct { // Lookup looks for the user ID for a particular domain. Lookup func(domain string) (*Dest, error) // DialHome provides a dialer for dialing home for endpoint name "~". DialHome func(ctx context.Context) (net.Conn, error) // DialForward provides a dialer for dialing a domain for endpoint // that is fowarding to a TCP. If this is not provided, // a default network TCP dailing will be used. DialForward func(ctx context.Context, fwd string) (net.Conn, error) // SideToken gets a token for side connections. SideToken func(user string) (string, error) // OnConnect is called when a new endpoint connects. It returns // a session ID. This callback function is optional. OnConnect func(user string) int64 // OnDisconnect is called when a new endpoint disconnects. It is // called with the user's name and the session ID got from // OnConnect. If OnConnect is not set, session is always 0. OnDisconnect func(user string, session int64) }
ServerConfig contains configuration of an SNI based proxy server.
type StaticRouter ¶
StaticRouter routes to the given host with the given token.
type TLSHelloConn ¶
TLSHelloConn wraps a connection and peeks the hello info.
func NewTLSHelloConn ¶
func NewTLSHelloConn(conn net.Conn) *TLSHelloConn
NewTLSHelloConn wraps conn and reads the TLS ClientHello inforamtion.
func (*TLSHelloConn) HelloInfo ¶
func (c *TLSHelloConn) HelloInfo() (*TLSHelloInfo, error)
HelloInfo returns the SNI information extracted from the TLS ClientHello, without consuming any bytes from br. On any error, the empty string is returned.
type TLSHelloInfo ¶
TLSHelloInfo contains the brief information about at TLS ClientHello message.
Source Files ¶
- buffer_size.go
- call_exchange.go
- close_once.go
- conn_mailbox.go
- connection.go
- connections.go
- decoder.go
- dial.go
- dialer.go
- encoder.go
- endian.go
- endpoint.go
- endpoint_client.go
- endpoint_exchange.go
- endpoint_server.go
- errors.go
- first_err.go
- messages.go
- msg_close.go
- msg_dial.go
- msg_hello.go
- msg_read.go
- msg_status.go
- msg_write.go
- options.go
- proxy.go
- remote_err.go
- request_util.go
- router.go
- server.go
- session_id.go
- session_key.go
- side_conn.go
- tls_hello_conn.go
- transport.go
- transport_call.go
- tunnel.go
- websocket_dialer.go