ws

package
v0.0.0-...-58652bc Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Hub *hub

Functions

func BuildNewTunnel

func BuildNewTunnel(addr string)

func CompressByGzip

func CompressByGzip(in []byte) ([]byte, error)

func DecompressByGzip

func DecompressByGzip(in []byte) ([]byte, error)

func Decrypt

func Decrypt(key, input []byte) ([]byte, error)

func DirectRequest

func DirectRequest(req *http.Request, target *url.URL)

DirectRequest routes URLs to the scheme, host, and base path provided in target. If the target's path is "/base" and the incoming request was for "/dir", the target request will be for /base/dir. Learn NewSingleHostReverseProxy from https://golang.org/src/net/http/httputil/reverseproxy.go

func Forward

func Forward(target string, rw http.ResponseWriter, req *http.Request)

func NewDefaultHub

func NewDefaultHub() *hub

func ServeWS

func ServeWS(w http.ResponseWriter, r *http.Request)

serveWS handles websocket requests from the peer.

Types

type Client

type Client struct {
	sync.RWMutex
	// client ID
	ID uint64
	// contains filtered or unexported fields
}

Client is a middleman between the websocket connection and the hub.

func NewClient

func NewClient(addr string) *Client

func (*Client) Dial

func (c *Client) Dial() error

func (*Client) Run

func (c *Client) Run()

func (*Client) SendPacket

func (c *Client) SendPacket(pkt *packet.Packet, rsper *Responser) error

type Messager

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

Messager is messager for client and msg pair.

type Responser

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

Jump to

Keyboard shortcuts

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