ws

package
v0.0.0-...-9709314 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: AGPL-3.0, Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Upgrader = websocket.Upgrader{
	CheckOrigin:      checkOrigin,
	HandshakeTimeout: time.Second * 5,
}

Upgrader is a websocket upgrader that validates the Origin header.

Functions

func Mirror

func Mirror(conn *websocket.Conn, rwc io.ReadWriteCloser) (chRead chan error, chWrite chan error)

Mirror takes a websocket and replicates all read/write to a ReadWriteCloser. Returns channels indicating when reads and writes are finished (respectively).

func MirrorRead

func MirrorRead(conn *websocket.Conn, rc io.Reader) chan error

MirrorRead is a uni-directional mirror which replicates an io.Reader to a websocket.

func MirrorWrite

func MirrorWrite(conn *websocket.Conn, wc io.Writer) chan error

MirrorWrite is a uni-directional mirror which replicates a websocket to an io.Writer.

func NewWrapper

func NewWrapper(conn *websocket.Conn) io.ReadWriteCloser

NewWrapper returns a new ReadWriteCloser wrapper for a websocket connection.

func Proxy

func Proxy(source *websocket.Conn, target *websocket.Conn) chan struct{}

Proxy mirrors the traffic between two websockets.

func StartKeepAlive

func StartKeepAlive(conn *websocket.Conn)

StartKeepAlive sets TCP_USER_TIMEOUT and TCP keep alive timeouts on a connection and starts a periodic websocket ping go routine if the underlying connection is TCP. Otherwise this is a no-op.

Types

This section is empty.

Jump to

Keyboard shortcuts

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