Documentation
¶
Index ¶
- Variables
- func Mirror(ctx context.Context, conn *websocket.Conn, rwc io.ReadWriteCloser) (chan struct{}, chan struct{})
- func MirrorRead(ctx context.Context, conn *websocket.Conn, rc io.ReadCloser) chan struct{}
- func MirrorWithHooks(ctx context.Context, conn *websocket.Conn, rwc io.ReadWriteCloser, ...) (chan struct{}, chan struct{})
- func MirrorWrite(ctx context.Context, conn *websocket.Conn, wc io.WriteCloser) chan struct{}
- func NewWrapper(conn *websocket.Conn) io.ReadWriteCloser
- func Proxy(source *websocket.Conn, target *websocket.Conn) chan struct{}
Constants ¶
This section is empty.
Variables ¶
var Upgrader = websocket.Upgrader{ CheckOrigin: func(r *http.Request) bool { return true }, HandshakeTimeout: time.Second * 5, }
Upgrader is a websocket upgrader which ignores the request Origin.
Functions ¶
func Mirror ¶
func Mirror(ctx context.Context, conn *websocket.Conn, rwc io.ReadWriteCloser) (chan struct{}, chan struct{})
Mirror takes a websocket and replicates all read/write to a ReadWriteCloser. Returns channels indicating when reads and writes are finished (respectively).
func MirrorRead ¶
MirrorRead is a uni-directional mirror which replicates an io.ReadCloser to a websocket.
func MirrorWithHooks ¶
func MirrorWithHooks(ctx context.Context, conn *websocket.Conn, rwc io.ReadWriteCloser, hookRead func(conn *websocket.Conn), hookWrite func(conn *websocket.Conn)) (chan struct{}, chan struct{})
MirrorWithHooks is identical to Mirror but allows for code to be run at the end of the read or write operations. Returns channels indicating when reads and writes are finished (respectively).
func MirrorWrite ¶
MirrorWrite is a uni-directional mirror which replicates a websocket to an io.WriteCloser.
func NewWrapper ¶
func NewWrapper(conn *websocket.Conn) io.ReadWriteCloser
NewWrapper returns a new ReadWriteCloser wrapper for a websocket connection.
Types ¶
This section is empty.