new TorController(socket [, options])
Parameters:
| Name | Type | Argument | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
socket |
Socket | net.Socket connected to Tor's control port | |||||||||||
options |
object |
<optional> |
Properties
|
- Source:
Methods
-
<static> createChallengeResponse(cookie, clientNonce, serverNonce)
-
Creates the challenge response from a SAFECOOKIE challenge
Parameters:
Name Type Description cookiestring The secret cookie string clientNoncestring Client nonce sent with auth challenge serverNoncestring Server nonce reply from auth challenge - Source:
Returns:
- Type
- string
-
<static> createReplySplitter()
-
Creates a message splitter from incoming socket data
- Source:
-
addEventListeners(events, callback)
-
Instructs Tor to send asynchronous events for the given types - these events will be emitted from the controller. Calling this method resets previously set event listeners
Parameters:
Name Type Description eventsArray.<string> List of event types to listen for callbackTorController~addEventListenersCallback -
attachStream(streamId [, circuitId] [, hopNumber], callback)
-
Attaches the specified stream to the given circuit
Parameters:
Name Type Argument Default Description streamIdstring ID for the stream to attach circuitIdstring <optional>
0 Circuit to attach stream hopNumbernumber <optional>
Which hop to exit circuit callbackTorController~attachStreamCallback - Source:
-
authenticate(token, callback)
-
Authenticates with the control port given the supplied param
Parameters:
Name Type Description tokenstring callbackTorController~authenticateCallback - Source:
-
cleanCircuits(callback)
-
Clears DNS cache and establishes new clean circuits
Parameters:
Name Type Description callbackTorController~cleanCircuitsCallback - Source:
-
clearDnsCache(callback)
-
Forget client side hostname->ip cache
Parameters:
Name Type Description callbackTorController~clearDnsCacheCallback - Source:
-
closeCicuit(circuitId [, options], callback)
-
Closes the given circuit
Parameters:
Name Type Argument Description circuitIdstring ID for the circuit to close optionsobject <optional>
Properties
Name Type Argument Default Description ifUnusedboolean <optional>
false Only close if not in use callbackTorController~closeCircuitCallback - Source:
-
closeStream(streamId [, reason], callback)
-
Closes the exit for the given stream
Parameters:
Name Type Argument Default Description streamIdstring ID for the stream to close reasonnumber <optional>
1 Reason code for closing stream callbackTorController~closeStreamCallback -
createAddressMapping(target, replacement, callback)
-
Instruct Tor to route requests to the target to the replacement
Parameters:
Name Type Description targetstring Original address to map replacementstring New address to route request to target callbackTorController~createAddressMappingCallback - Source:
-
createCircuit( [purpose], callback)
-
Creates a new circuit, returning the newly created circuit ID
Parameters:
Name Type Argument Default Description purposestring <optional>
"general" The circuit purpose, either general|controller callbackTorController~createCircuitCallback - Source:
-
createHiddenService(ports [, options], callback)
-
Establishes a hidden service on the given target
Parameters:
Name Type Argument Description portsarray Array containing optional virtualPort (defaults to 80) and target ip:port string optionsobject <optional>
module:commands#ADD_ONION callbackTorController~createHiddenServiceCallback - Source:
-
destroyHiddenService(serviceId, callback)
-
Takes down a running hidden service owned by this controller
Parameters:
Name Type Description serviceIdstring Tor hidden service ID callbackTorController~destroyHiddenServiceCallback - Source:
-
dropGuards(callback)
-
Tells the server to drop all guard nodes. Do not invoke this command lightly; it can increase vulnerability to tracking attacks over time.
Parameters:
Name Type Description callbackTorController~dropGuardsCallback - Source:
-
dumpHeartbeat(callback)
-
Dumps a heartbeat message to the logs
Parameters:
Name Type Description callbackTorController~dumpHeartbeatCallback - Source:
-
dumpStats(callback)
-
Dump stats to tor log file
Parameters:
Name Type Description callbackTorController~dumpStatsCallback - Source:
-
enableDebug(callback)
-
Set open logs to debug level
Parameters:
Name Type Description callbackTorController~enableDebugCallback - Source:
-
extendCircuit(circuitId, callback)
-
Extends the existing circuit
Parameters:
Name Type Description circuitIdstring The circuit ID to extend callbackTorController~extendCircuitCallback - Source:
-
fetchHiddenServiceDescriptor(serviceId [, serverLongName], callback)
-
Fetches descriptors for the given hidden service
Parameters:
Name Type Argument Description serviceIdstring ID for the hidden service serverLongNamestring <optional>
Long name for specific server to use callbackTorController~fetchHiddenServiceDescriptorCallback - Source:
-
getAuthChallenge(nonce, callback)
-
Requests an authentication challenge from tor
Parameters:
Name Type Description noncestring Client nonce for authenticating callbackTorController~getAuthChallengeCallback - Source:
-
getConfig(keyword, callback)
-
Return the values for the given configuration key
Parameters:
Name Type Description keywordstring Configuration key callbackTorController~getConfigCallback - Source:
-
getInfo(keyword, callback)
-
Get information from Tor not stored in configuration
Parameters:
Name Type Description keywordstring Keyword for info to fetch callbackTorController~getInfoCallback -
getProtocolInfo(callback)
-
Ask tor for general information
Parameters:
Name Type Description callbackTorController~getProtocolInfoCallback - Source:
-
halt(callback)
-
Shutdown tor immediately
Parameters:
Name Type Description callbackTorController~haltCallback - Source:
-
loadConfig(configText, callback)
-
Instruct Tor to load the configuration file from the given text
Parameters:
Name Type Description configTextstring Complete torrc config text to load callbackTorController~loadConfigCallback - Source:
-
postDescriptor(descriptor [, options], callback)
-
Inform the server about a new descriptor
Parameters:
Name Type Argument Description descriptorobject Key-value pairs for server descriptor optionsobject <optional>
Properties
Name Type Argument Default Description purposestring <optional>
"general" general|controller|bridge cacheboolean <optional>
true Flag for caching descriptor callbackTorController~postDescriptorCallback - Source:
-
postHiddenServiceDescriptor(descriptor [, serverLongName], callback)
-
Launch a hidden service descriptor upload
Parameters:
Name Type Argument Description descriptorstring serverLongNamestring <optional>
Long name for specific server to use callbackTorController~postHiddenServiceDescriptorCallback -
quit(callback)
-
Tells Tor to hang up on the controller
Parameters:
Name Type Description callbackTorController~quitCallback - Source:
-
redirectStream(streamId, address [, port], callback)
-
Change the exit address on a given stream
Parameters:
Name Type Argument Description streamIdstring ID for stream to redirect addressstring Exit address for the given stream portnumber <optional>
Exit port for the given stream callbackTorController~redirectStreamCallback - Source:
-
reloadConfig(callback)
-
Reloads the config values set
Parameters:
Name Type Description callbackTorController~reloadConfigCallback - Source:
-
removeEventListeners(callback)
-
Instructs Tor to stop listening for events
Parameters:
Name Type Description callbackTorController~removeEventListenersCallback - Source:
-
resetConfig(keyword, callback)
-
Change the value for a configuration variable to it's default
Parameters:
Name Type Description keywordstring Configuration key callbackTorController~resetConfigCallback - Source:
-
resolve(address [, options], callback)
-
Launch remote hostname lookup - answer returnd as async ADDRMAP event
Parameters:
Name Type Argument Description addressstring Address to lookup optionsobject <optional>
Properties
Name Type Argument Default Description reverseboolean <optional>
false Perform reverse lookup callbackTorController~resolveCallback - Source:
-
saveConfig(callback)
-
Tell Tor to write out it's config value to it's torrc
Parameters:
Name Type Description callbackTorController~saveConfigCallback - Source:
-
setCircuitPurpose(circuitId, purpose, callback)
-
Sets the purpose of the given circuit
Parameters:
Name Type Description circuitIdstring The identifier for the circuit purposestring One of general|controller callbackTorController~setCircuitPurposeCallback - Source:
-
setConfig(keyword, value, callback)
-
Change the value for a configuration variable
Parameters:
Name Type Description keywordstring Configuration key valuestring New value to set callbackTorController~setConfigCallback - Source:
-
shutdown(callback)
-
Controlled shutdown signal
Parameters:
Name Type Description callbackTorController~shutdownCallback - Source:
-
signal(signal, callback)
-
Sends a signal to the control port
Parameters:
Name Type Description signalstring callbackTorController~signalCallback - Source:
-
takeOwnership(callback)
-
Take ownership of the tor process - will close tor when the connection closes
Parameters:
Name Type Description callbackTorController~takeOwnershipCallback - Source:
Type Definitions
-
addEventListenersCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
attachStreamCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
cleanCircuitsCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
clearDnsCacheCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
closeCircuitCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
closeStreamCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
createAddressMappingCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
createCircuitCallback(error, result)
-
Parameters:
Name Type Description errorobject | null resultArray.<string> - Source:
-
createHiddenServiceCallback(error, result)
-
Parameters:
Name Type Description errorobject | null resultAddOnionResult - Source:
-
destroyHiddenServiceCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
dropGuardsCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
dumpHeartbeatCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
dumpStatsCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
enableDebugCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
extendCircuitCallback(error, result)
-
Parameters:
Name Type Description errorobject | null resultArray.<string> - Source:
-
fetchHiddenServiceDescriptorCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
getAuthChallengeCallback(error, result)
-
Parameters:
Name Type Description errorobject | null resultAuthChallengeResult - Source:
-
getConfigCallback(error, result)
-
Parameters:
Name Type Description errorobject | null resultGetConfigResult - Source:
-
getInfoCallback(error, result)
-
Parameters:
Name Type Description errorobject | null resultstring - Source:
-
getProtocolInfoCallback(error, result)
-
Parameters:
Name Type Description errorobject | null resultProtocolInfoResult - Source:
-
haltCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
loadConfigCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
postDescriptorCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
postHiddenServiceDescriptorCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
quitCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
redirectStreamCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
reloadConfigCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
resetConfigCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
resolveCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
saveConfigCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
setCircuitPurposeCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
setConfigCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
shutdownCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
signalCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
-
takeOwnershipCallback(error)
-
Parameters:
Name Type Description errorobject | null - Source:
Events
-
close
-
Fires when the underlying socket closes
- Source:
-
error
-
Fired when the underlying socket encounters an error
Type: error
- Source:
-
ready
-
Fires when the controller is authenticated and ready to send commands
- Source: