new TorContext(torConfigopt, torControlopt)
Primary interface for doing things "over tor". Manages a tor process, creates and establishes a control connection, and offers it's own interface for creating and handling connections made through the tor network.
Name | Type | Attributes | Description |
---|---|---|---|
torConfig | module:bulb/config~TorConfig | | <optional> | Configuration for the tor process |
torControl | module:bulb/control~TorControl | | <optional> | Control connection to a tor process |
- Source
Members
control
Connection to the to control port.
Name | Type | Description |
---|---|---|
control | module:bulb/control~TorControl |
- Source
process
Child tor process managed by this context.
Name | Type | Description |
---|---|---|
process | child_process. |
- Source
Methods
connect(optionsopt) → {Promise.<module:bulb/network~HiddenSocket>}
Alias for module:bulb/context~TorContext#createConnection that automatically calls the returned module:bulb/network~HiddenSocket#connect.
Name | Type | Attributes | Description |
---|---|---|---|
options | module:bulb/network~HiddenSocket~ConnectOptions | <optional> | Passed to the created module:bulb/network~HiddenSocket. |
- Source
- Type:
- Promise.<module:bulb/network~HiddenSocket>
createConnection(connectListeneropt) → {module:bulb/network~HiddenSocket}
Create a "tor-ified" TCP socket in this module:bulb/context~TorContext.
Name | Type | Attributes | Description |
---|---|---|---|
connectListener | module:bulb/network~HiddenSocket~ConnectListener | <optional> | Sets a one time listener for module:bulb/network~HiddenSocket#events:connect. |
- Source
createServer(optionsopt, connectionListeneropt) → {module:bulb/network~HiddenServer}
Create a "tor-ified" TCP server in this context. Exposes an onion service.
Name | Type | Attributes | Description |
---|---|---|---|
options | module:bulb/network~HiddenServer~ServerOptions | <optional> | Passed to the created modulex:bulb/network~HiddenServer. |
connectionListener | module:bulb/network~HiddenServer~ConnectionListener | <optional> | Passed to the created module:bulb/network~HiddenServer. |
- Source
createTorHttpAgent() → {module:bulb/network~TorHttpAgent}
Create a "tor-ified" http.Agent for sending HTTP requests through this context.
- Source
openControlConnection(optionsopt) → {Promise.<module:bulb/control~TorControl>}
Connects the module:bulb/control~TorControl to the child process.
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options | object | <optional> | Properties
|
- Source
- Type:
- Promise.<module:bulb/control~TorControl>
readControlPort(delayopt) → {Promise.<number>}
Reads the tor process control port.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
delay | number | <optional> | 10 | Milliseconds to wait before read |
- Source
port
- Type:
- Promise.<number>
readSocksPort() → {Promise.<number>}
Reads the tor process SOCKSv5 proxy port.
- Source
port
- Type:
- Promise.<number>
spawnTorChildProcess(argsopt) → {Promise.<process.ChildProcess>}
Spawns a tor process for this context.
Name | Type | Attributes | Description |
---|---|---|---|
args | Array.<string> | <optional> | Arguments to pass the tor executable |
- Source
- Type:
- Promise.<process.ChildProcess>
(static) create(optionsopt) → {Promise.<module:bulb/context~TorContext>}
Creates a module:bulb/context~TorContext, automtically calling module:bulb/context~TorContext#spawnTorChildProcess and module:bulb/context~TorContext#openControlConnection before resolving.
Name | Type | Attributes | Description |
---|---|---|---|
options | module:bulb/config~TorConfig | | <optional> | Passed to the created module:bulb/context~TorContext. |
- Source
- Type:
- Promise.<module:bulb/context~TorContext>
(static) getExecPath(platformopt) → {string}
Returns the local path to the tor bundle.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
platform | string | <optional> | os.platform() | OS identifier |
- Source
- Type:
- string