ws

package
v0.16.3 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-3.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FrameReader

func FrameReader(r io.Reader, server bool) io.Reader

FrameReader returns a chunked reader.

func FrameWriter

func FrameWriter(w io.Writer, server bool) io.Writer

FrameWriter returns a frame writer.

func NewWSDialer

func NewWSDialer(s string, d proxy.Dialer) (proxy.Dialer, error)

NewWSDialer returns a ws proxy dialer.

func NewWSSDialer added in v0.15.0

func NewWSSDialer(s string, d proxy.Dialer) (proxy.Dialer, error)

NewWSSDialer returns a wss proxy dialer.

func NewWSSServer added in v0.15.0

func NewWSSServer(s string, p proxy.Proxy) (proxy.Server, error)

NewWSSServer returns a wss transport server.

func NewWSServer added in v0.12.1

func NewWSServer(s string, p proxy.Proxy) (proxy.Server, error)

NewWSServer returns a ws transport server.

Types

type ClientConn added in v0.12.1

type ClientConn struct {
	net.Conn
	// contains filtered or unexported fields
}

ClientConn is a connection to ws server.

func (*ClientConn) Handshake added in v0.12.1

func (c *ClientConn) Handshake(host, path, origin string) error

Handshake handshakes with the server using HTTP to request a protocol upgrade.

func (*ClientConn) Read added in v0.12.1

func (c *ClientConn) Read(b []byte) (n int, err error)

func (*ClientConn) Write added in v0.12.1

func (c *ClientConn) Write(b []byte) (n int, err error)

type ServerConn added in v0.12.1

type ServerConn struct {
	net.Conn
	// contains filtered or unexported fields
}

ServerConn is a connection to ws client.

func (*ServerConn) Handshake added in v0.12.1

func (c *ServerConn) Handshake(host, path string) error

Handshake handshakes with the client.

func (*ServerConn) Read added in v0.12.1

func (c *ServerConn) Read(b []byte) (n int, err error)

func (*ServerConn) Write added in v0.12.1

func (c *ServerConn) Write(b []byte) (n int, err error)

type WS

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

WS is the base ws proxy struct.

func NewWS

func NewWS(s string, d proxy.Dialer, p proxy.Proxy, withTLS bool) (*WS, error)

NewWS returns a websocket proxy.

func (*WS) Addr

func (s *WS) Addr() string

Addr returns forwarder's address.

func (*WS) Dial

func (s *WS) Dial(network, addr string) (net.Conn, error)

Dial connects to the address addr on the network net via the proxy.

func (*WS) DialUDP

func (s *WS) DialUDP(network, addr string) (net.PacketConn, error)

DialUDP connects to the given address via the proxy.

func (*WS) ListenAndServe added in v0.12.1

func (s *WS) ListenAndServe()

ListenAndServe listens on server's addr and serves connections.

func (*WS) NewClientConn added in v0.12.1

func (s *WS) NewClientConn(rc net.Conn) (*ClientConn, error)

NewClientConn creates a new ws client connection.

func (*WS) NewServerConn added in v0.12.1

func (s *WS) NewServerConn(rc net.Conn) (*ServerConn, error)

NewServerConn creates a new ws server connection.

func (*WS) Serve added in v0.12.1

func (s *WS) Serve(cc net.Conn)

Serve serves a connection.

Jump to

Keyboard shortcuts

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