bulb/network~ HiddenServer

new HiddenServer(context, connectionListeropt)

Wraps a net.Server, exposing it as an onion service.

Parameters:
NameTypeAttributesDescription
contextmodule:bulb/context~TorContext

Tor context to create onion.

connectionListermodule:bulb/network~HiddenServer~ConnectionListener<optional>

Function to handle incoming connections

Methods

address() → {module:bulb/network~HiddenServer~Address}

Returns the hidden service's address

listen(addOnionOptions) → {Promise.<module:bulb/network~HiddenServer~Address>}

Calls the underlying net.Socket#listen, then establishes a connection as on onion service using the current tor context.

Parameters:
NameTypeDescription
addOnionOptionsmodule:bulb/commands~ControlCommand~AddOnionOptions

Type Definitions

Address

Type:
  • object
Properties
NameTypeDescription
hoststring

Onion address for this service.

portnumber

Virtual port on the onion service.

ConnectionListener(connection)

Handles incoming connections.

Parameters:
NameTypeDescription
connectionnet.Socket