bridge

package module
v0.0.0-...-6f1fec7 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: MIT Imports: 6 Imported by: 0

README

bridge

TCP over Websocket in Go.

Documentation

Index

Constants

View Source
const BufferBytes = 8 << 10

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPListener

type HTTPListener struct {
	Address       string
	RemoteAddress string
}

func NewHTTPListener

func NewHTTPListener() *HTTPListener

func (*HTTPListener) Listen

func (l *HTTPListener) Listen()

func (*HTTPListener) TranslateTCP

func (l *HTTPListener) TranslateTCP(r io.Reader, w io.WriteCloser) error

TranslateTCP makes TCP connection with remote host and call TCPConn.Handle.

type TCPConn

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

TCPConn is wrapper of net.Conn.

func (*TCPConn) Handle

func (t *TCPConn) Handle(r io.Reader, w io.WriteCloser)

Handle reads from TCP connection and write it to w. Also, reads from r and write it to TCP connection.

type TCPListener

type TCPListener struct {
	Address        string
	RemoteAddress  string
	RemoteProtocol string
}

func NewTCPListener

func NewTCPListener() *TCPListener

func (*TCPListener) Listen

func (l *TCPListener) Listen()

func (*TCPListener) TranslateWebsocket

func (l *TCPListener) TranslateWebsocket(r io.Reader, w io.WriteCloser) error

TranslateWebsocket makes Websocket connection with remote server and call WebsocketConn.Handle.

type WebsocketConn

type WebsocketConn struct {
	*websocket.Conn
}

WebsocketConn is wrapper of websocket.Conn.

func (*WebsocketConn) Handle

func (ws *WebsocketConn) Handle(r io.Reader, w io.WriteCloser)

Handle reads from Websocket connection and write it to w. Also, reads from r and write it to Websocket connection.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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