websocket

package
v0.0.0-...-f5bbbf4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Forward

func Forward(_ context.Context, from, to *websocket.Conn) error

func NewDialer

func NewDialer(cfg *DialerConfig) *websocket.Dialer

func NewUpgrader

func NewUpgrader(cfg *UpgraderConfig) *websocket.Upgrader

func PipeConn

func PipeConn(ctx context.Context, clientConn, serverConn *websocket.Conn) (clientErrors, serverErrors <-chan error)

Types

type DialerConfig

type DialerConfig struct {
	HandshakeTimeout  *json.Duration `json:"handshakeTimeout,omitempty"`
	ReadBufferSize    *int           `json:"readBufferSize,omitempty"`
	WriteBufferSize   *int           `json:"writeBufferSize,omitempty"`
	EnableCompression *bool          `json:"enableCompression,omitempty"`
}

func (*DialerConfig) SetDefault

func (cfg *DialerConfig) SetDefault() *DialerConfig

type InterceptorFunc

type InterceptorFunc func(ctx context.Context, clientConn, serverConn *websocket.Conn) (clientErrors, serverErrors <-chan error)

type Proxy

type Proxy struct {
	Interceptor InterceptorFunc

	ReqPreparer  request.Preparer
	RespModifier response.Modifier

	ErrorHandler proxy.HandleRoundTripErrorFunc

	Upgrader *websocket.Upgrader
	Dialer   *websocket.Dialer

	PingPongTimeout        time.Duration
	WriteControlMsgTimeout time.Duration
	CloseGracePeriod       time.Duration
	// contains filtered or unexported fields
}

func NewProxy

func NewProxy(cfg *ProxyConfig, logger log.Logger) *Proxy

func (*Proxy) Done

func (prx *Proxy) Done() <-chan struct{}

func (*Proxy) RegisterServerShutdown

func (prx *Proxy) RegisterServerShutdown(srv *http.Server)

func (*Proxy) ServeHTTP

func (prx *Proxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*Proxy) Start

func (prx *Proxy) Start(context.Context) error

func (*Proxy) Stop

func (prx *Proxy) Stop(ctx context.Context) error

Stop proxy

type ProxyConfig

type ProxyConfig struct {
	Upgrader *UpgraderConfig `json:"upgrader,omitempty"`
	Dialer   *DialerConfig   `json:"dialer,omitempty"`

	PingPongTimeout        *json.Duration `json:"pingPongTimeout,omitempty"`
	WriteControlMsgTimeout *json.Duration `json:"writeControlMsgTimeout,omitempty"`
}

func (*ProxyConfig) SetDefault

func (cfg *ProxyConfig) SetDefault() *ProxyConfig

type UpgraderConfig

type UpgraderConfig struct {
	HandshakeTimeout  *json.Duration `json:"handshakeTimeout,omitempty"`
	ReadBufferSize    *int           `json:"readBufferSize,omitempty"`
	WriteBufferSize   *int           `json:"writeBufferSize,omitempty"`
	EnableCompression *bool          `json:"enableCompression,omitempty"`
}

func (*UpgraderConfig) SetDefault

func (cfg *UpgraderConfig) SetDefault() *UpgraderConfig

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL