158 lines
9.6 KiB
HTML
158 lines
9.6 KiB
HTML
{% extends "_layout.html" %}
|
|
{% 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</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:
|
|
{"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:
|
|
{"id":"id","result":{"Result-key-1":"result-value-1","Result-key-2":"result-value-2"},"jsonrpc":"2.0"}
|
|
|
|
</pre></div>
|
|
</p>
|
|
<ul>method-name – Description
|
|
<ul>Request
|
|
<li>Param-key-1 – Description</li>
|
|
<li>Param-key-2 – Description</li>
|
|
<li>Token – Token used for authenticating every request (excluding the 'Authenticate' RPC method)</li>
|
|
</ul>
|
|
<ul>Response
|
|
<li>Result-key-1 – Description</li>
|
|
<li>Result-key-2 – Description</li>
|
|
</ul>
|
|
</ul>
|
|
|
|
<h4>Implemented methods</h4>
|
|
<ul>Authenticate – Creates and returns an authentication token used for further communication.
|
|
<ul>Request
|
|
<li>Password – [String] The password used for authenticating against the remote server.</li>
|
|
</ul>
|
|
<ul>Response
|
|
<li>Token – [String] The token used for further communication.</li>
|
|
</ul>
|
|
</ul>
|
|
<ul>Echo – Echoes the value of the echo key, used for debugging and testing.
|
|
<ul>Request
|
|
<li>Echo – [String] Value will be returned in response.</li>
|
|
<li>Token – [String]Token used for authenticating the client. Is provided by the server via the 'Authenticate' RPC method.</li>
|
|
</ul>
|
|
<ul>Response
|
|
<li>Result – [String] Value of the key 'echo' in the request.</li>
|
|
</ul>
|
|
</ul>
|
|
<ul>GetRate – Fetches rateStat from router statManager. Creates stat if not already created.
|
|
<ul>Request
|
|
<li>Stat – [String] Determines which rateStat to fetch, see <a href="ratestats.html">ratestats</a>.</li>
|
|
<li>Period – [long] Determines which period a stat is fetched for.</li>
|
|
<li>Token – [String] Token used for authenticating the client. Is provided by the server via the 'Authenticate' RPC method.</li>
|
|
</ul>
|
|
<ul>Response
|
|
<li>Result – [double] Returns the average value for the reuested rateStat and period.</li>
|
|
</ul>
|
|
</ul>
|
|
<ul>I2PControl – Manages I2PControl. Ports, passwords and the like.
|
|
<ul>Request
|
|
<li>*i2pcontrol.password – [String] Sets a new password for I2PControl, all Authentication tokens will be revoked.</li>
|
|
<li>*i2pcontrol.port – [String] Switches which port I2PControl will listen for connections on.</li>
|
|
<li>Token – [String] Token used for authenticating the client. Is provided by the server via the 'Authenticate' RPC method.</li>
|
|
</ul>
|
|
<ul>Response
|
|
<li>**i2pcontrol.password – [null] Returned if setting was changed</li>
|
|
<li>**i2pcontrol.port – [null] Returned if setting was changed</li>
|
|
</ul>
|
|
</ul>
|
|
<ul>RouterInfo – Fetches basic information about hte I2P router. Uptime, version etc.
|
|
<ul>Request
|
|
<li>*i2p.router.status – [n/a]</li>
|
|
<li>*i2p.router.uptime – [n/a]</li>
|
|
<li>*i2p.router.version – [n/a]</li>
|
|
<li>*i2p.router.net.status – [n/a]</li>
|
|
<li>Token – [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 – [String] What the status of the router is.</li>
|
|
<li>**i2p.router.uptime – [String] What the uptime of the router is.</li>
|
|
<li>**i2p.router.version – [String] What version of I2P the router is running.</li>
|
|
<li>**i2p.router.net.status – [String] What the current netowrk status is.</li>
|
|
</ul>
|
|
</ul>
|
|
<ul>RouterRunner – Manages I2P router restart/shutdown.
|
|
<ul>Request
|
|
<li>*Restart – [n/a] Restarts the router.</li>
|
|
<li>*RestartGraceful – [n/a] Restarts the router gracefully (waits for participating tunnels to expire).</li>
|
|
<li>*Shutdown – [n/a] Shuts down the router.</li>
|
|
<li>*ShutdownGraceful – [n/a] Shuts down the router gracefully (waits for participating tunnels to expire).</li>
|
|
<li>Token – [String] Token used for authenticating the client. Is provided by the server via the 'Authenticate' RPC method.</li>
|
|
</ul>
|
|
<ul>Response
|
|
<li>**Restart – [null] If requested, verifies that a restart has been initiated.</li>
|
|
<li>**RestartGraceful – [null] If requested, verifies that a graceful restart has been initiated.</li>
|
|
<li>**Shutdown – [null] If requested, verifies that a shutdown has been initiated</li>
|
|
<li>**ShutdownGraceful – [null] If requested, verifies that a graceful shutdown has been initiated</li>
|
|
</ul>
|
|
</ul>
|
|
<ul>NetworkSetting – Fetches or sets various network related settings. Ports, addresses etc.
|
|
<ul>Request
|
|
<li>*i2p.router.net.ntcp.port – [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 – [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 – [String] Use automatically detected ip for TCP transport. If null is submitted, current setting will be returned.</li>
|
|
<li>*i2p.router.net.ssu.port – [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 – [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 – [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 – [null] What ip has been detected by the UDP transport.</li>
|
|
<li>*i2p.router.net.upnp – [String] Is UPNP enabled. If null is submitted, current setting will be returned.</li>
|
|
<li>*i2p.router.net.bw.share – [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 – [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 – [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 – [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 – [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
|
|
<li>**i2p.router.net.ntcp.port – [String] If requested, returns the port used for the TCP transport.</li>
|
|
<li>**i2p.router.net.ntcp.hostname – [String] If requested, returns the hostname used for the TCP transport.</li>
|
|
<li>**i2p.router.net.ntcp.autoip – [String] If requested, returns the method used for automatically detecting ip for the TCP transport.</li>
|
|
<li>**i2p.router.net.ssu.port – [String] If requested, returns the port used for the UDP transport.</li>
|
|
<li>**i2p.router.net.ssu.hostname – [String] If requested, returns the hostname used for the UDP transport.</li>
|
|
<li>**i2p.router.net.ssu.autoip – [String] If requested, returns methods used for detecting the ip address of the UDP transport.</li>
|
|
<li>**i2p.router.net.ssu.detectedip – [String] If requested, returns what ip has been detected by the UDP transport.</li>
|
|
<li>**i2p.router.net.upnp – [String] If requested, returns the UPNP setting.</li>
|
|
<li>**i2p.router.net.bw.share – [String] If requested, returns how many percent of bandwidth is usable for participating tunnels.</li>
|
|
<li>**i2p.router.net.bw.in – [String] If requested, returns how many KB/s of inbound bandwidth is allowed.</li>
|
|
<li>**i2p.router.net.bw.out – [String] If requested, returns how many KB/s of outbound bandwidth is allowed.</li>
|
|
<li>**i2p.router.net.laptopmode – [String] If requested, returns the laptop mode.</li>
|
|
<li>SettingsSaved – [boolean] Have the provided settings been saved.</li>
|
|
<li>RestartNeeded – [boolean] Is a restart needed for the new settings to be used.</li>
|
|
</ul>
|
|
</ul>
|
|
<p>* denotes an optional value.</p>
|
|
<p>** denotes a possibly occuring return value</p>
|
|
|
|
<h3>Error codes</h3>
|
|
<ul>Standard JSON-RPC2 error codes.
|
|
<li>-32700 – JSON parse error.</li>
|
|
<li>-32600 – Invalid request.</li>
|
|
<li>-32601 – Method not found.</li>
|
|
<li>-32603 – Internal error.</li>
|
|
</ul>
|
|
<ul>I2PControl specific error codes.
|
|
<li>-32001 – Invalid password provided.</li>
|
|
<li>-32002 – No authentication token presented.</li>
|
|
<li>-32003 – Authentication token doesn't exist.</li>
|
|
<li>-32004 – The provided authentication token was expired and will be removed.</li>
|
|
</ul>
|
|
|
|
|
|
|
|
{% endblock %}
|