Files
i2p.www/www.i2p2/pages/i2pcontrol.html

184 lines
12 KiB
HTML
Raw Normal View History

{% extends "_layout.html" %}
2011-07-12 16:51:08 +00:00
{% block title %}I2PControl API{% endblock %}
{% block content %}
<h1>I2PControl - Remote Control Service</h1>
<p>I2P enables a <a href="http://en.wikipedia.org/wiki/JSON-RPC">JSONRPC2</a> interface via the plugin I2PControl.
The aim of the interface is to provide simple way to interface with a running I2P node. A client, itoopie, has been developed in parallel.
The JSONRPC2 implementation for the client as well as the plugin is provided by the java libraries <a href="http://software.dzhuvinov.com/json-rpc-2.0.html">JSON-RPC 2.0</a>.
A list of implementations of JSON-RPC for various languages can be found at <a href="http://json-rpc.org/wiki/implementations">the JSON-RPC wiki</a>.
</p>
<h2>API, version 1.</h2>
<p>
Parameters are only provided in a named way (maps).
<h4>JSON-RPC 2 format</h4>
<div class="box" style="clear: none;"><pre>
Request:
2011-07-08 09:40:32 +00:00
{"id":"id", "method":"Method-name","params":{"Param-key-1":"param-value-1", "Param-key-2":"param-value-2", "Token":"**actual token**"}, "jsonrpc":"2.0"}
Response:
2011-07-08 09:40:32 +00:00
{"id":"id","result":{"Result-key-1":"result-value-1","Result-key-2":"result-value-2"},"jsonrpc":"2.0"}
</pre></div>
</p>
<ul>method-name &ndash; Description
<ul>Request
2011-07-08 09:40:32 +00:00
<li>Param-key-1 &ndash; Description</li>
<li>Param-key-2 &ndash; Description</li>
<li>Token &ndash; Token used for authenticating every request (excluding the 'Authenticate' RPC method)</li>
</ul>
<ul>Response
2011-07-08 09:40:32 +00:00
<li>Result-key-1 &ndash; Description</li>
<li>Result-key-2 &ndash; Description</li>
</ul>
</ul>
<h4>Implemented methods</h4>
2011-07-08 09:40:32 +00:00
<ul>Authenticate &ndash; Creates and returns an authentication token used for further communication.
<ul>Request
<li>API &ndash; [long] The version of the I2PControl API used by the client.</li>
2011-07-08 09:40:32 +00:00
<li>Password &ndash; [String] The password used for authenticating against the remote server.</li>
</ul>
<ul>Response
<li>API &ndash; [long] The primare I2PControl API version implemented by the server.</li>
2011-07-08 09:40:32 +00:00
<li>Token &ndash; [String] The token used for further communication.</li>
</ul>
</ul>
2011-07-08 09:40:32 +00:00
<ul>Echo &ndash; Echoes the value of the echo key, used for debugging and testing.
<ul>Request
2011-07-08 09:40:32 +00:00
<li>Echo &ndash; [String] Value will be returned in response.</li>
<li>Token &ndash; [String]Token used for authenticating the client. Is provided by the server via the 'Authenticate' RPC method.</li>
</ul>
<ul>Response
2011-07-08 09:40:32 +00:00
<li>Result &ndash; [String] Value of the key 'echo' in the request.</li>
</ul>
</ul>
2011-07-08 09:40:32 +00:00
<ul>GetRate &ndash; Fetches rateStat from router statManager. Creates stat if not already created.
<ul>Request
2011-07-08 09:40:32 +00:00
<li>Stat &ndash; [String] Determines which rateStat to fetch, see <a href="ratestats.html">ratestats</a>.</li>
2011-07-19 14:09:16 +00:00
<li>Period &ndash; [long] Determines which period a stat is fetched for.</li>
2011-07-08 09:40:32 +00:00
<li>Token &ndash; [String] Token used for authenticating the client. Is provided by the server via the 'Authenticate' RPC method.</li>
</ul>
<ul>Response
2011-07-08 09:40:32 +00:00
<li>Result &ndash; [double] Returns the average value for the reuested rateStat and period.</li>
</ul>
</ul>
2011-07-19 14:09:16 +00:00
<ul>I2PControl &ndash; Manages I2PControl. Ports, passwords and the like.
<ul>Request
<li>*i2pcontrol.password &ndash; [String] Sets a new password for I2PControl, all Authentication tokens will be revoked.</li>
<li>*i2pcontrol.port &ndash; [String] Switches which port I2PControl will listen for connections on.</li>
<li>Token &ndash; [String] Token used for authenticating the client. Is provided by the server via the 'Authenticate' RPC method.</li>
</ul>
<ul>Response
<li>**i2pcontrol.password &ndash; [null] Returned if setting was changed</li>
<li>**i2pcontrol.port &ndash; [null] Returned if setting was changed</li>
</ul>
</ul>
<ul>RouterInfo &ndash; Fetches basic information about hte I2P router. Uptime, version etc.
<ul>Request
<li>*i2p.router.status &ndash; [n/a]</li>
<li>*i2p.router.uptime &ndash; [n/a]</li>
<li>*i2p.router.version &ndash; [n/a]</li>
<li>*i2p.router.net.bw.inbound.1s &ndash; [n/a] </li>
<li>*i2p.router.net.bw.inbound.15s &ndash; [n/a] </li>
<li>*i2p.router.net.bw.outbound.1s &ndash; [n/a] </li>
<li>*i2p.router.net.bw.outbound.15s &ndash; [n/a] </li>
2011-07-19 14:09:16 +00:00
<li>*i2p.router.net.status &ndash; [n/a]</li>
<li>*i2p.router.net.tunnels.participating &ndash; [n/a] </li>
<li>*i2p.router.netdb.activepeers &ndash; [n/a] </li>
<li>*i2p.router.netdb.fastpeers &ndasg; [n/a] </li>
<li>*i2p.router.netdb.highcapacitypeers &ndash; [n/a] </li>
<li>*i2p.router.netdb.isreseeding &ndash; [n/a] </li>
<li>*i2p.router.netdb.knownpeers &ndash; [n/a] </li>
2011-07-19 14:09:16 +00:00
<li>Token &ndash; [String] Token used for authenticating the client. Is provided by the server via the 'Authenticate' RPC method.</li>
</ul>
<ul>Response
<li>**i2p.router.status &ndash; [String] What the status of the router is.</li>
2011-07-26 13:19:40 +00:00
<li>**i2p.router.uptime &ndash; [long] What the uptime of the router is in ms.</li>
<li>**i2p.router.version &ndash; [String] What version of I2P the router is running.</li>
<li>**i2p.router.net.bw.inbound.1s &ndash; [double] The 1 second average inbound bandwidth in Bps.</li>
<li>**i2p.router.net.bw.inbound.15s &ndash; [double] The 15 second average inbound bandwidth in Bps.</li>
<li>**i2p.router.net.bw.outbound.1s &ndash; [double] The 1 second average outbound bandwidth in Bps.</li>
<li>**i2p.router.net.bw.outbound.15s &ndash; [double] The 15 second average outbound bandwidth in Bps.</li>
<li>**i2p.router.net.status &ndash; [String] What the current netowrk status is.</li>
<li>**i2p.router.net.tunnels.participating &ndash; [long] How many tunnels on the I2P net are we participating in.</li>
<li>**i2p.router.netdb.activepeers &ndash; [long] How many peers have we communicated with recently.</li>
<li>**i2p.router.netdb.fastpeers &ndasg; [long] How many peers are considered 'fast'.</li>
<li>**i2p.router.netdb.highcapacitypeers &ndash; [long] How many peers are considered 'high capacity'.</li>
<li>**i2p.router.netdb.isreseeding &ndash; [boolean] Is the router reseeding hosts to its NetDB?</li>
<li>**i2p.router.netdb.knownpeers &ndash; [long] How many peers are known to us (listed in our NetDB).</li>
</ul>
</ul>
<ul>RouterManager &ndash; Manages I2P router restart/shutdown.
<ul>Request
<li>*Reseed &ndash; [n/a] Initiates a router reseed, fetching peers into our NetDB from a remote host.</li>
<li>*Restart &ndash; [n/a] Restarts the router.</li>
<li>*RestartGraceful &ndash; [n/a] Restarts the router gracefully (waits for participating tunnels to expire).</li>
<li>*Shutdown &ndash; [n/a] Shuts down the router.</li>
<li>*ShutdownGraceful &ndash; [n/a] Shuts down the router gracefully (waits for participating tunnels to expire).</li>
2011-07-19 14:09:16 +00:00
<li>Token &ndash; [String] Token used for authenticating the client. Is provided by the server via the 'Authenticate' RPC method.</li>
</ul>
<ul>Response
<li>**Reseed &ndash; [null] If requested, verifies that a reseed has been initiated.</li>
<li>**Restart &ndash; [null] If requested, verifies that a restart has been initiated.</li>
<li>**RestartGraceful &ndash; [null] If requested, verifies that a graceful restart has been initiated.</li>
<li>**Shutdown &ndash; [null] If requested, verifies that a shutdown has been initiated</li>
<li>**ShutdownGraceful &ndash; [null] If requested, verifies that a graceful shutdown has been initiated</li>
</ul>
</ul>
<ul>NetworkSetting &ndash; Fetches or sets various network related settings. Ports, addresses etc.
<ul>Request
2011-07-08 09:40:32 +00:00
<li>*i2p.router.net.ntcp.port &ndash; [String] What port is used for the TCP transport. If null is submitted, current setting will be returned.</li>
<li>*i2p.router.net.ntcp.hostname &ndash; [String] What hostname is used for the TCP transport. If null is submitted, current setting will be returned.</li>
<li>*i2p.router.net.ntcp.autoip &ndash; [String] Use automatically detected ip for TCP transport. If null is submitted, current setting will be returned.</li>
<li>*i2p.router.net.ssu.port &ndash; [String] What port is used for the UDP transport. If null is submitted, current setting will be returned.</li>
<li>*i2p.router.net.ssu.hostname &ndash; [String] What hostname is used for the UDP transport. If null is submitted, current setting will be returned.</li>
<li>*i2p.router.net.ssu.autoip &ndash; [String] Which methods should be used for detecting the ip address of the UDP transport. If null is submitted, current setting will be returned.</li>
<li>*i2p.router.net.ssu.detectedip &ndash; [null] What ip has been detected by the UDP transport.</li>
<li>*i2p.router.net.upnp &ndash; [String] Is UPNP enabled. If null is submitted, current setting will be returned.</li>
<li>*i2p.router.net.bw.share &ndash; [String] How many percent of bandwidth is usable for participating tunnels. If null is submitted, current setting will be returned.</li>
<li>*i2p.router.net.bw.in &ndash; [String] How many KB/s of inbound bandwidth is allowed. If null is submitted, current setting will be returned.</li>
<li>*i2p.router.net.bw.out &ndash; [String] How many KB/s of outbound bandwidth is allowed. If null is submitted, current setting will be returned.</li>
<li>*i2p.router.net.laptopmode &ndash; [String] Is laptop mode enabled (change router identity and UDP port when IP changes ). If null is submitted, current setting will be returned.</li>
<li>Token &ndash; [String] Token used for authenticating the client. Is provided by the server via the 'Authenticate' RPC method. If null is submitted, current setting will be returned.</li>
</ul>
<ul>Response
2011-07-08 09:40:32 +00:00
<li>**i2p.router.net.ntcp.port &ndash; [String] If requested, returns the port used for the TCP transport.</li>
<li>**i2p.router.net.ntcp.hostname &ndash; [String] If requested, returns the hostname used for the TCP transport.</li>
<li>**i2p.router.net.ntcp.autoip &ndash; [String] If requested, returns the method used for automatically detecting ip for the TCP transport.</li>
<li>**i2p.router.net.ssu.port &ndash; [String] If requested, returns the port used for the UDP transport.</li>
<li>**i2p.router.net.ssu.hostname &ndash; [String] If requested, returns the hostname used for the UDP transport.</li>
<li>**i2p.router.net.ssu.autoip &ndash; [String] If requested, returns methods used for detecting the ip address of the UDP transport.</li>
<li>**i2p.router.net.ssu.detectedip &ndash; [String] If requested, returns what ip has been detected by the UDP transport.</li>
<li>**i2p.router.net.upnp &ndash; [String] If requested, returns the UPNP setting.</li>
<li>**i2p.router.net.bw.share &ndash; [String] If requested, returns how many percent of bandwidth is usable for participating tunnels.</li>
<li>**i2p.router.net.bw.in &ndash; [String] If requested, returns how many KB/s of inbound bandwidth is allowed.</li>
<li>**i2p.router.net.bw.out &ndash; [String] If requested, returns how many KB/s of outbound bandwidth is allowed.</li>
<li>**i2p.router.net.laptopmode &ndash; [String] If requested, returns the laptop mode.</li>
<li>SettingsSaved &ndash; [boolean] Have the provided settings been saved.</li>
<li>RestartNeeded &ndash; [boolean] Is a restart needed for the new settings to be used.</li>
</ul>
</ul>
<p>* denotes an optional value.</p>
2011-07-08 09:40:32 +00:00
<p>** denotes a possibly occuring return value</p>
<h3>Error codes</h3>
<ul>Standard JSON-RPC2 error codes.
<li>-32700 &ndash; JSON parse error.</li>
<li>-32600 &ndash; Invalid request.</li>
<li>-32601 &ndash; Method not found.</li>
<li>-32603 &ndash; Internal error.</li>
</ul>
<ul>I2PControl specific error codes.
<li>-32001 &ndash; Invalid password provided.</li>
<li>-32002 &ndash; No authentication token presented.</li>
<li>-32003 &ndash; Authentication token doesn't exist.</li>
<li>-32004 &ndash; The provided authentication token was expired and will be removed.</li>
<li>-32005 &ndash; The version of the I2PControl API used wasn't specified, but is required to be specified.</li>
<li>-32006 &ndash; The version of the I2PControl API specified is not supported by I2PControl.</li>
</ul>
{% endblock %}