Server

Manages a collection of proxy tunnels and routing incoming requests

Constructor

new Server(options)

Represents a tunnel/proxy server

Parameters:
NameTypeDescription
optionsObject
Properties
NameTypeAttributesDefaultDescription
proxyMaxConnectionsNumber<optional>
48

Max tunnels for proxy

loggerObject<optional>
console

Custom logger to use

Methods

getProxyInfoById(id) → {object}

Returns some metadata / diagnostic information about a given proxy

Parameters:
NameTypeDescription
idstring

Public key hash

Returns:
Type: 
object

listen(port)

Listens for tunnel clients on the port

Parameters:
NameTypeDescription
portnumber

routeHttpRequest(proxyId, request, response)

Routes the incoming HTTP request to it's corresponding proxy

Parameters:
NameTypeDescription
proxyIdString

The unique ID for the proxy instance

requesthttp.IncomingMessage
responsehttp.ServerResponse

routeWebSocketConnection(proxyId, request, socket)

Routes the incoming WebSocket connection to it's corresponding proxy

Parameters:
NameTypeDescription
proxyIdString

The unique ID for the proxy instance

requesthttp.IncomingMessage
socketnet.Socket