Global

Members

(constant) env_whitelist :Array.<string>

Source:
An array of all valid environment variables
Type:

logger :Logger

Source:
Instnace of `winston.Logger`
Type:
  • Logger

nconf :Provider

Source:
Instance of `nconf.Provider`
Type:
  • Provider

(constant) REALM :string

Source:
Default Value:
  • Name of instance to route to
What will show up when an unauthenticated user attempts to connect when an invalid username
Type:
  • string

(constant) TOR_ROUTER_PROXY_AGENT :string

Source:
Default Value:
  • tor-router
Value of the "Proxy-Agent" header that will be sent with each http-connect (https) request
Type:
  • string

Methods

assembleHost(host) → {string}

Source:
Takes an object with a hostname and port returns a formatted string
Parameters:
Name Type Description
host Host
Returns:
- Formatted host (e.g. "0.0.0.0:1234")
Type
string

cleanUp(error)

Source:
Kills all tor processes and exits, logging an error if one occurs.
Parameters:
Name Type Description
error Error Error or exit code

(async) main(nconf, loggeropt) → {Promise}

Source:
Main function for the application
Parameters:
Name Type Attributes Description
nconf Provider Instance of `nconf.Provider` used for configuration.
logger Logger <optional>
Winston logger to be used for logging. If not provided will disable logging.
Returns:
Type
Promise

setup_nconf_env(nconf) → {Provider}

Source:
Sets up nconf with the `env` store.
Parameters:
Name Type Description
nconf Provider Instance of `nconf.Provider`.
Returns:
- Same instance of `nconf.Provider`.
Type
Provider

Type Definitions

InstanceConnectionSource

Source:
Properties:
Name Type Description
hostname string Hostname where the connection was made from.
port number Port where the connection was made from.
by_name boolean Indicates whether the connection was made using a username (made to a specific instance or group of instances).
proto string The protocol of the connection "socks", "http", "http-connect" or "dns"
Details on the source of a connection the proxy server.

InstanceDefinition

Source:
Properties:
Name Type Attributes Default Description
Name string <optional>
Name of the instance.
Group Array.<string> | string <optional>
[] Groups the instance belongs to.
Config Object <optional>
{} Configuration that will be passed to Tor. See Tor Documentation for all possible options.
Weight Number <optional>
Weight of the instance for "weighted" load balancing.
Type:
  • Object

InstanceGroup

Source:
Properties:
Name Type Description
add function Adds an instance to the group.
remove function Removes an instance from the group.
add_by_name function Adds an instance to the group by the TorProcess#instance_name property on the instance.
remove_by_name function Removes an instance from the group by the TorProcess#instance_name property on the instance.
remove_at function Removes an instance from the group by the index of the instance in the group.
length number The size of the group of instances
rotate function Rotates the array of instances
Represents a group of instances. Group is a Proxy with an array as its object. The array is generated by calling TorPool#instances_in_group. When called with an index (e.g. `Group[0]`) will return the instance at that index. Helper functions are available as properties.
Type:

InstanceGroupCollection

Source:
Represents a collection of groups as an associative array. GroupCollection is a Proxy with a Set as its object. The Set is TorPool#group_names. If a non-existant group is referenced (e.g. `Groups["doesn't exist"]`) it will be created. So `Groups["doesn't exist"].add(my_instance)` will create the group and add the instance to it.
Type:

ProxyByNameConfig

Source:
Properties:
Name Type Attributes Default Description
deny_unidentified_users boolean <optional>
false Deny unauthenticated (e.g. no username - socks://my-server:9050) users access to the proxy server.
mode string Either "group" for routing to a group of instances or "individual" for routing to individual instances.
Configuration for the "proxy by name" feature (connecting to specific instances or groups of instances using the username field when connecting).