websocket

package
v0.0.0-...-16f15bb Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MaxInt = int(MaxUint >> 1)
View Source
const MaxUint = ^uint(0)
View Source
const MinInt = -MaxInt - 1
View Source
const MinUint = 0

Variables

This section is empty.

Functions

func NopReadSeekCloser

func NopReadSeekCloser(rs io.ReadSeeker) nopReadSeekCloser

func RunClient

func RunClient(ctx context.Context, cfg ClientConfig) (err error)

Types

type ClientConfig

type ClientConfig struct {
	// contains filtered or unexported fields
}

func NewClientConfig

func NewClientConfig(serverAddr string, roundTripper http.RoundTripper, options ...ClientConfigOption) *ClientConfig

type ClientConfigOption

type ClientConfigOption interface {
	ApplyToClientConfig(*ClientConfig)
}

func WithDialerCtor

func WithDialerCtor(dialerCtor func() *websocket.Dialer) ClientConfigOption

type ClientConfigOptionFunc

type ClientConfigOptionFunc func(cfg *ClientConfig)

func (ClientConfigOptionFunc) ApplyToClientConfig

func (opt ClientConfigOptionFunc) ApplyToClientConfig(c *ClientConfig)

type ConcurrencyCounter

type ConcurrencyCounter struct {
	// contains filtered or unexported fields
}

func NewCounter

func NewCounter() *ConcurrencyCounter

func (*ConcurrencyCounter) Count

func (c *ConcurrencyCounter) Count() int

func (*ConcurrencyCounter) Dec

func (c *ConcurrencyCounter) Dec()

func (*ConcurrencyCounter) Inc

func (c *ConcurrencyCounter) Inc()

func (*ConcurrencyCounter) Init

func (c *ConcurrencyCounter) Init(val int)

func (*ConcurrencyCounter) Max

func (c *ConcurrencyCounter) Max() int

func (*ConcurrencyCounter) Min

func (c *ConcurrencyCounter) Min() int

func (*ConcurrencyCounter) Set

func (c *ConcurrencyCounter) Set(val int)

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server implements a tunnel server using WebSockets

func NewServer

func NewServer(options ...ServerOption) *Server

NewServer returns a new Server instance

func (*Server) RoundTrip

func (s *Server) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip sends the request through the tunnel and returns the response

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves server control requests (e.g. connection)

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown initiates server shutdown, but does not wait for it to finish

type ServerOption

type ServerOption interface {
	ApplyToServer(*Server)
}

func WithUpgrader

func WithUpgrader(upgrader websocket.Upgrader) ServerOption

type ServerOptionFunc

type ServerOptionFunc func(*Server)

func (ServerOptionFunc) ApplyToServer

func (opt ServerOptionFunc) ApplyToServer(s *Server)

type WithLogger

type WithLogger logr.Logger

func (WithLogger) ApplyToClientConfig

func (opt WithLogger) ApplyToClientConfig(c *ClientConfig)

func (WithLogger) ApplyToServer

func (opt WithLogger) ApplyToServer(s *Server)

Jump to

Keyboard shortcuts

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