Adds documentation on all of the RPC methods

This commit is contained in:
Zachary Boyd 2018-05-09 21:56:00 -07:00
parent 12c00baecc
commit 62495b1e86
3 changed files with 98 additions and 0 deletions

View file

@ -113,6 +113,8 @@ Example (in node):
})
```
A full list of available RPC Methods can be [found here](https://github.com/znetstar/tor-router/docs/rpc-methods.md)
## Test
Tests are written in mocha, just run `npm test`

75
docs/rpc-methods.md Normal file
View file

@ -0,0 +1,75 @@
## RPC Functions
The following functions are available via the RPC
# queryInstances()
Returns an array containing information on the instances currently running under the router.
# createInstances(Array or Integrer)
If passed an integrer, creates thats many Tor instances. An array can also be passed describing the names, weights and configurations of prospective instances. :
```
var rpcRequest = {
"method": "createInstances",
"params": [
{
"Config": {
},
"Name": "instance-1",
"Weight": 10
},
...
],
"jsonrpc":"2.0",
"id": 1
};
```
Will wait until the Tor Instance has fully connected to the network before returning
# addInstances(Array)
Serves the same purpose as "createInstances" but only takes an Array
# removeInstances(Integrer)
Removes a number of instances
# removeInstanceAt(Integrer)
Remove a specific instance from the pool
# newIps()
Change the Tor Circuit on all instances
# newIpAt(Integrer)
Change the Tor Circuit on a specific instance
# nextInstance()
Cycle to the next instance using the load balancing method
# closeInstances()
Shutdown all Tor instances
# getTorConfig()
Retrieve the default Tor Config
# setTorConfig
Set the default Tor Config
# getLoadBalanceMethod
Get the current load balance method
# setLoadBalanceMethod
Set the current load balance method

21
src/default_config.js Normal file
View file

@ -0,0 +1,21 @@
// Default configuration for Tor Router
const temp = require('temp');
temp.track();
module.exports = {
"controlPort": 9077,
"parentDataDirectory": temp.mkdirSync(),
"socksPort": 9050,
"dnsPort": null,
"httpPort": null,
"logLevel": "info",
"loadBalanceMethod": "round_robin",
"torConfig": {
"Log": "notice stdout",
"NewCircuitPeriod": "10"
},
"instances": 1,
"dns": {
"options": {},
"timeout": null
},
};