From 62495b1e86553e3f1551dee64b624909b7bf7ea8 Mon Sep 17 00:00:00 2001 From: Zachary Boyd Date: Wed, 9 May 2018 21:56:00 -0700 Subject: [PATCH] Adds documentation on all of the RPC methods --- README.md | 2 ++ docs/rpc-methods.md | 75 +++++++++++++++++++++++++++++++++++++++++++ src/default_config.js | 21 ++++++++++++ 3 files changed, 98 insertions(+) create mode 100644 docs/rpc-methods.md create mode 100644 src/default_config.js diff --git a/README.md b/README.md index 447baba..9e1f58f 100644 --- a/README.md +++ b/README.md @@ -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` \ No newline at end of file diff --git a/docs/rpc-methods.md b/docs/rpc-methods.md new file mode 100644 index 0000000..7131d67 --- /dev/null +++ b/docs/rpc-methods.md @@ -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 \ No newline at end of file diff --git a/src/default_config.js b/src/default_config.js new file mode 100644 index 0000000..3712fc2 --- /dev/null +++ b/src/default_config.js @@ -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 + }, +}; \ No newline at end of file