Documentation
¶
Index ¶
- Constants
- func Dial(ctx context.Context, u string, opts *websocket.DialOptions) (*websocket.Conn, *http.Response, error)
- func DialerForGRPC(readLimit int64, dialOpts *websocket.DialOptions) func(context.Context, string) (net.Conn, error)
- func ProtocolHeader() http.Header
- type HttpHandler
- type Listener
- type ListenerWrapper
Constants ¶
View Source
const ( // TunnelWebSocketProtocol is a subprotocol that allows client and server recognize each other. // See https://tools.ietf.org/html/rfc6455#section-11.3.4. TunnelWebSocketProtocol = "ws-tunnel" )
Variables ¶
This section is empty.
Functions ¶
func DialerForGRPC ¶
func DialerForGRPC(readLimit int64, dialOpts *websocket.DialOptions) func(context.Context, string) (net.Conn, error)
DialerForGRPC can be used as an adapter between "ws"/"wss" URL scheme that the websocket library wants and gRPC target naming scheme.
func ProtocolHeader ¶
Types ¶
type HttpHandler ¶
type HttpHandler struct {
Ctx context.Context
AcceptOptions websocket.AcceptOptions
Sink chan<- net.Conn
// ReadLimit. Optional. See websocket.Conn.SetReadLimit().
ReadLimit int64
}
func (*HttpHandler) ServeHTTP ¶
func (h *HttpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ListenerWrapper ¶
type ListenerWrapper struct {
AcceptOptions websocket.AcceptOptions
// ReadLimit. Optional. See websocket.Conn.SetReadLimit().
ReadLimit int64
ReadTimeout time.Duration
ReadHeaderTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
MaxHeaderBytes int
ConnState func(net.Conn, http.ConnState)
ErrorLog *log.Logger
BaseContext func(net.Listener) context.Context
ConnContext func(ctx context.Context, c net.Conn) context.Context
}
Click to show internal directories.
Click to hide internal directories.