ControlServer

ControlServer

A server which exposes an RPC interface that can control the application.

Constructor

new ControlServer(nconf, loggeropt)

Source:
Parameters:
Name Type Attributes Description
nconf Provider Instance of nconf.Provider that will be used to obtain configuration values.
logger Logger <optional>
Winston logger that will be used for logging. If not provided will disable logging.

Members

logger :Logger

Source:
Winston Logger for logging
Type:
  • Logger

nconf :Provider

Source:
Nconf Provider for configuration
Type:
  • Provider

tor_pool :TorPool

Source:
Pool of Tor instances
Type:

Methods

(static) instance_info(instance) → {ControlServer~InstanceInfo}

Source:
Returns a summary of information on the running instance
Parameters:
Name Type Description
instance TorProcess
Returns:
Type
ControlServer~InstanceInfo

close()

Source:
Closes the TCP and/or WebSocket servers

(async) createDNSServer(port, hostnameopt) → {Promise}

Source:
Creates an instance of DNSServer and begins listening for traffic
Parameters:
Name Type Attributes Description
port number Port the server should bind to
hostname string <optional>
Host the server should bind to
Returns:
Type
Promise

(async) createHTTPServer(port, hostnameopt) → {Promise}

Source:
Creates an instance of HTTPServer and begins listening for traffic
Parameters:
Name Type Attributes Description
port number Port the server should bind to
hostname string <optional>
Host the server should bind to
Returns:
Type
Promise

(async) createSOCKSServer(port, hostnameopt) → {Promise}

Source:
Creates an instance of SOCKSServer and begins listening for traffic
Parameters:
Name Type Attributes Description
port number Port the server should bind to
hostname string <optional>
Host the server should bind to
Returns:
Type
Promise

createTorPool(tor_configopt, load_balance_methodopt) → {TorPool}

Source:
Creates a new TorPool instance
Parameters:
Name Type Attributes Description
tor_config Object <optional>
Default Tor config to be used for the pool of instances.
load_balance_method string <optional>
Load balance method to be used for the pool. Will default to the global configuration if not provided.
Returns:
- The TorPool that was created.
Type
TorPool

(async) listen(port, hostnameopt) → {Promise}

Source:
Calls ControlServer#listenTcp with the same arguments
Parameters:
Name Type Attributes Description
port number Port the server should bind to
hostname string <optional>
Host the server should bind to
Returns:
Type
Promise

(async) listenTcp(port, hostnameopt) → {Promise}

Source:
Binds the server to a host and port and begins listening for TCP traffic
Parameters:
Name Type Attributes Description
port number Port the server should bind to
hostname string <optional>
Host the server should bind to
Returns:
Type
Promise

(async) listenWs(port, hostnameopt) → {Promise}

Source:
Binds the server to a host and port and begins listening for WebSocket traffic
Parameters:
Name Type Attributes Description
port number Port the server should bind to
hostname string <optional>
Host the server should bind to
Returns:
Type
Promise

Type Definitions

InstanceInfo

Source:
Properties:
Name Type Attributes Description
name string Name of the instance.
group Array.<string> Groups the instance belongs to.
dns_port number Port Tor is listening on for DNS Traffic.
socks_port number Port Tor is listening on for SOCKS Traffic.
process_id number Process ID for the Tor process.
config Object Configuration (torrc) set when starting the process.
weight number <optional>
Weight of the instance for weighted load balancing.