#Cjdns Admin API
Cjdns is inspected and configured through a UDP socket. When cjdroute starts up, it reads the configuration file and spawns cjdns core. The core knows nothing but the port which it should bind to and the private key which it should use. All other information such as peers, interfaces and passwords is given to the core through the admin UDP interface. When cjdroute is finished setting up the core, it exits leaving the core running in the background.
You can call all of the functions which are called by cjdroute to collect information and alter the core's configuration.
To call a function you send a udp packet containing a bencoded request to the core and it sends back a bencoded response.
echo -n 'd1:q4:pinge' | nc6 -u -t 1 -n -w3 127.0.0.1 11234
If you are more comfortable writing json then benc, you can use benc2json in reverse mode to
preprocess your message. Note: benc2json has been removed in 2821c81d49
to speed up the build.
echo '{ "q": "ping" }' | ./build/benc2json -r
Stream the request from json into benc and then make the request to the core:
echo '{ "q": "ping" }' \
| ./build/benc2json -r \
| tr -d '\n' \
| nc6 -u -t 1 -n -w3 127.0.0.1 11234
Get the result back into json:
echo '{ "q": "ping" }' \
| ./build/benc2json -r \
| tr -d '\n' \
| nc6 -u -t 1 -n -w3 127.0.0.1 11234 \
| ./build/benc2json
Because you can send multiple messages at once, you may add a transaction ID to a message and it will be reflected back to you in the response.
echo '{ "q": "ping", "txid": "my request" }' \
| ./build/benc2json -r \
| tr -d '\n' \
| nc6 -u -t 1 -n -w3 127.0.0.1 11234 \
| ./build/benc2json
Result:
{
"txid" : "my request",
"q" : "pong"
}
Some functions require arguments and others allow arguments but assume defaults if they are
not provided. Arguments are sent to a function through a benc dictionary called args
.
The Admin_availableFunctions()
function has an optional argument called page
, this is
because there are too many functions to be described in a single UDP packet. The following
command will get the first page of functions from Admin_availableFunctions
which will
describe other functions and their required and allowed arguments.
echo -n '
{
"q": "Admin_availableFunctions",
"args": {
"page": 0
}
}' | ./build/benc2json -r \
| tr -d '\n' \
| nc6 -u -t 1 -n -w3 127.0.0.1 11234 \
| ./build/benc2json
Any function which changes the state of cjdns core requires authentication to carry out. Authentication is done on a per-request basis. Functions which don't require authentication can still be called with authentication and will still fail if the authentication is incorrect.
Step 1: Request a cookie from the server.
Step 2: Calculate the SHA-256 of the cookie and your admin password, place this hash and cookie in the request.
Step 3: Calculate the SHA-256 of the entire request with the hash and cookie added, replace the hash in the request with this result.
Steps 1 and 2 securely bind the cookie to the password so that the password hash cannot be taken and used again in another request later on, step 3 binds the cookie and password to the request so that a man-in-the-middle cannot change the content of the request in flight.
A plain request such as {"q": "ping"}
becomes {"q":"auth", "aq":"ping", "hash":<calculated hash>}
.
The q
field is moved to aq
(authenticated query) and the q
field says auth
.
NOTE: A cookie is only valid for 10 seconds so requesting and using a cookie must be done in the same script.
NOTE2: Cookies are reusable for now this is not part of the API and is considered a bug, you should always request a new cookie for each authenticated request otherwise you may be broke by changes in the future.
Step 1: Get the cookie
RESP=`echo -n 'd1:q6:cookiee' | nc6 -u -t 1 -n -w3 127.0.0.1 11234` \
echo response=${RESP}; \
COOKIE=`echo ${RESP} | sed 's/d6:cookie10:\([0-9]*\)e/\1/'` \
echo cookie=${COOKIE};
Step 2: Calculate the hash of the cookie and password:
For this step, you will need the admin password from your cjdroute.conf file, it's to be found
inside of the block which says "admin": {
.
ADMIN_PASS=you_will_find_this_in_your_cjdroute_dot_conf \
REQUEST='{"q": "auth", "aq": "ping", "hash": "__HASH__", "cookie": "__COOKIE__"}' \
COOKIE_RESP=`echo -n 'd1:q6:cookiee' | nc6 -u -t 1 -n -w3 127.0.0.1 11234` \
COOKIE=`echo ${COOKIE_RESP} | sed 's/d6:cookie10:\([0-9]*\)e/\1/'` \
HASH_ONE=`echo -n "${ADMIN_PASS}${COOKIE}" | sha256sum -b | cut -d\ -f1` ; \
REQ_ONE=`echo $REQUEST | sed -e "s/__HASH__/${HASH_ONE}/" -e "s/__COOKIE__/${COOKIE}/" \
| ./build/benc2json -r | tr -d '\n'` ; \
echo "hash of password and cookie is ${HASH_ONE}" ; \
echo "Request with cookie and hash added:" ; \
echo "${REQ_ONE}" ; \
echo "JSON version of request:" ; \
echo "${REQ_ONE}" | ./build/benc2json
Step 3: Calculate the SHA-256 of the entire request and replace the one in the request: This will calculate the final request and send it to cjdns.
ADMIN_PASS=you_will_find_this_in_your_cjdroute_dot_conf \
REQUEST='{"q": "auth", "aq": "ping", "hash": "__HASH__", "cookie": "__COOKIE__"}' \
COOKIE_RESP=`echo -n 'd1:q6:cookiee' | nc6 -u -t 1 -n -w3 127.0.0.1 11234` \
COOKIE=`echo ${COOKIE_RESP} | sed 's/d6:cookie10:\([0-9]*\)e/\1/'` \
HASH_ONE=`echo -n "${ADMIN_PASS}${COOKIE}" | sha256sum -b | cut -d\ -f1` \
REQ_ONE=`echo $REQUEST | sed -e "s/__HASH__/${HASH_ONE}/" -e "s/__COOKIE__/${COOKIE}/" \
| ./build/benc2json -r | tr -d '\n'` \
FINAL_HASH=`echo -n "$REQ_ONE" | sha256sum -b | cut -d\ -f1` \
FINAL_REQ=`echo $REQ_ONE | sed -e "s/${HASH_ONE}/${FINAL_HASH}/"` ; \
echo -n "$FINAL_REQ" \
| nc6 -u -t 1 -n -w3 127.0.0.1 11234 \
| ./build/benc2json
If you see this:
{
"q" : "pong"
}
then it has succeeded, if the password is incorrect, you will see this:
{
"error" : "Auth failed."
}
Obviously using bash to craft cjdns admin RPC calls is probably the most awkward way possible,
there are tools in cjdns/contrib which will help you craft requests, specifically there are
libraries written in python and perl which will allow users to call cjdns internal functions
as python/perl native functions. A tool called cexec
is provided with the python library which
allows you to call cjdns functions from shell scripts or the command line as follows:
./contrib/python/cexec 'ping()'
user@ubnta8:~/wrk/cjdns$ ./contrib/python/cexec 'functions()' | sort
Admin_asyncEnabled()
Admin_availableFunctions(page='')
Allocator_bytesAllocated()
Allocator_snapshot(includeAllocations='')
AuthorizedPasswords_add(password, user, authType='', ipv6=0)
AuthorizedPasswords_list()
AuthorizedPasswords_remove(user)
Core_exit()
Core_initTunnel(desiredTunName=0)
Core_pid()
ETHInterface_beacon(interfaceNumber='', state='')
ETHInterface_beginConnection(publicKey, macAddress, interfaceNumber='', password=0)
ETHInterface_new(bindDevice)
InterfaceController_disconnectPeer(pubkey)
InterfaceController_peerStats(page='')
IpTunnel_allowConnection(publicKeyOfAuthorizedNode, ip6Address=0, ip4Address=0)
IpTunnel_connectTo(publicKeyOfNodeToConnectTo)
IpTunnel_listConnections()
IpTunnel_removeConnection(connection)
IpTunnel_showConnection(connection)
memory()
NodeStore_dumpTable(page)
NodeStore_getLink(parent, linkNum)
NodeStore_getRouteLabel(pathParentToChild, pathToParent)
NodeStore_nodeForAddr(ip=0)
ping()
RainflyClient_addKey(ident)
RainflyClient_addServer(addr)
RainflyClient_minSignatures(count)
RouterModule_findNode(nodeToQuery, target, timeout='')
RouterModule_getPeers(path, nearbyPath=0, timeout='')
RouterModule_lookup(address)
RouterModule_pingNode(path, timeout='')
SearchRunner_showActiveSearch(number)
Security_checkPermissions()
Security_dropPermissions()
Security_setUser(user)
SessionManager_getHandles(page='')
SessionManager_sessionStats(handle)
SwitchPinger_ping(path, data=0, keyPing='', timeout='')
UDPInterface_beginConnection(publicKey, address, interfaceNumber='', password=0)
UDPInterface_new(bindAddress=0)
###RouterModule_pingNode()
Auth Required
Send a node a cjdns ping request.
Parameters:
required String path may be a route such as "0000.0000.0000.1d53" or an ip address such as "fc5d:baa5:61fc:6ffd:9554:67f0:e290:7536", or an ip with explicit path eg: "fc5d:baa5:61fc:6ffd:9554:67f0:e290:7536@0000.0000.0000.1d53"
Int timeout (optional) the number of milliseconds after which to timeout the ping if there is no response. Defaults to router's adaptive ping timeout if unspecified.
Responses:
error: could not find node to ping
if there was no node by the given address found in the
routing table
result: timeout
gives timeout and number of milliseconds since the ping.
result: pong
gives version
representing the git hash of the source code which built the
pinged node, and ms
which is the number of milliseconds since the original ping.
Examples:
>>> cjdns.RouterModule_pingNode('fc38:4c2c:1a8f:3981:f2e7:c2b9:6870:6e84')
{'version': '5c5e84ccdba3f31f7c88077729700b4368320bc2', 'result': 'pong', 'ms': 79}
>>> cjdns.RouterModule_pingNode('fc5d:baa5:61fc:6ffd:9554:67f0:e290:7536')
{'error': 'could not find node to ping'}
>>> cjdns.RouterModule_pingNode('0000.0000.0000.0013')
{'version': '2b62b9ae911f1044e45f3f28fdd63d0d5a7fc512', 'result': 'pong', 'ms': 0}
>>> cjdns.RouterModule_pingNode('a')
{'error': "Unexpected length, must be either 39 char ipv6 address (with leading zeros)
eg: 'fc4f:000d:e499:8f5b:c49f:6e6b:01ae:3120' or 19 char path eg: '0123.4567.89ab.cdef'"}
>>> cjdns.RouterModule_pingNode('aaaaaaaaaaaaaaaaaaa')
{'error': 'parse path failed'}
>>> cjdns.RouterModule_pingNode('aaaaaaaaaaaaaaaaaaazzzzzzzzzzzzzzzzzzzz')
{'error': 'parsing address failed'}
>>> cjdns.RouterModule_pingNode('fc38:4c2c:1a8f:3981:f2e7:c2b9:6870:6e84', 10)
{'result': 'timeout', 'ms': 10}
ETHInterface is a connector which allows cjdns nodes on the same lan to automatically connect without the need to IP addresses on the LAN or sharing of connection credentials. It works on wireless LANs as well as wired ethernet LANs.
Create a new ETHInterface and bind it to a device.
NOTE: this call will always fail with 'error': 'call to socket() failed. [permission denied]'
unless it is running as root and will fail with process cannot open more files
if
Security_setUser()
has already been called.
Auth Required
Parameters:
eth0
or wlan0
.Returns:
Connect an ETHInterface to another computer which has an ETHInterface running.
Auth Required
Parameters:
UDPInterface_beginConnection()
Returns:
none
if everything went well.Other errors are self-explanitory.
Enable or disable sending or receiving of ETHInterface beacon messages. ETHInterface uses periodic beacon messages to automatically peer nodes which are on the same LAN. Be mindful that if your lan has is open wifi, enabling beaconing will allow anyone to peer with you.
Auth Required
Beacon States:
Parameters:
Returns:
none
if all went well.Example:
$ ./contrib/python/cexec 'ETHInterface_beacon(2)'
{'txid': 'FYRKHAPIM3', 'error': 'invalid interfaceNumber'}
$ ./contrib/python/cexec 'ETHInterface_beacon(0)'
{'txid': 'Z7KHE7SZ5R', 'state': 2, 'stateName': 'sending and accepting', 'error': 'none'}
$ ./contrib/python/cexec 'ETHInterface_beacon(0, 0)'
{'txid': 'TP1R8PYCNS', 'state': 0, 'stateName': 'disabled', 'error': 'none'}
$ ./contrib/python/cexec 'ETHInterface_beacon(0, 1)'
{'txid': 'UGKKGX4ZC9', 'state': 1, 'stateName': 'accepting', 'error': 'none'}
$ ./contrib/python/cexec 'ETHInterface_beacon(0, 2)'
{'txid': '1B7RXJEH3N', 'state': 2, 'stateName': 'sending and accepting', 'error': 'none'}
IPTunnel is designed to allow tunneling of IPv4 and IPv6 packets through a cjdns network
to the external internet or to a virtual LAN. It provides familiar VPN type functionality.
There are 2 nodes, a client and a server, the server uses IPTunnel_allowConnection()
and the
client uses IPTunnel_connectTo()
the server assigns IPv4 and/or IPv6 addresses to the client
and the client is required to use only these addresses, subnet assignment is not supported.
When the client uses IPTunnel_connectTo()
, it sends a request to the server for addresses and
continues polling the server periodically until the addresses are provided.
List the connection numbers of all IPTunnel connections.
Auth Required
Returns:
none
Example:
$ ./contrib/python/cexec 'IpTunnel_listConnections()'
{'connections': [0], 'txid': '5ZFPFJ60AT', 'error': 'none'}
Show information about a perticular IPTunnel connection.
Auth Required
Parameters:
Returns:
none
unless the connection number is invalid.Examples:
# Prior to getting it's addresses from the server, they are not listed.
$ ./contrib/python/cexec 'IpTunnel_showConnection(0)'
{'outgoing': 1, 'txid': 'REIV40SXD9', 'key': 'd5d0wu0usrkufd8s98t19gt7m2ggvbz1xbnuxu82x63uqlnk2kb0.k', 'error': 'none'}
# After a short wait, the addresses are provided and they are now listed.
$ ./contrib/python/cexec 'IpTunnel_showConnection(0)'
{'outgoing': 1, 'txid': 'CAQCTWECRD', 'ip4Address': '192.168.10.2', 'key': 'd5d0wu0usrkufd8s98t19gt7m2ggvbz1xbnuxu82x63uqlnk2kb0.k', 'error': 'none', 'ip6Address': '2a02:2498:e000:20::144:3'}
Remove an IPTunnel connection from the list, the other end will nolonger be able to send traffic over this connection.
Auth Required
NOT IMPLEMENTED
Initiate an outgoing connection to another node and request IP addresses from them.
Auth Required
Parameters:
Returns:
none
if all went wellExamples:
$ ./contrib/python/cexec 'IpTunnel_connectTo("d5d0wu0usrkufd8s98t19gt7m2ggvbz1xbnuxu82x63uqlnk2kb0.k")'
{'connection': 1, 'txid': '9QXRQO1FG8', 'error': 'none'}
Allow in incoming connection from another node, they must also use IPTunnel_connectTo()
in order
to complete the connection.
Auth Required
Parameters:
Returns:
none
if all went well.UDPInterface is the basic cjdns interface which is used to link distant nodes over the internet. It will work on a LAN as long as the nodes have IP addresses but for linking on a LAN, ETHInterface is easier.
Create a new UDPInterface which is either bound to an address/port or not.
NOTE: This call will fail with 'error': 'call to socket() failed [process cannot open more files]'
is Security_noFiles()
has already been called.
Parameters:
0.0.0.0
.Returns:
none
if all went wellUDPInterface_beginConnection()
Start a direct connection to another node.
Auth Required
Parameters:
Note: just because it returns 'error': 'none'
does not mean that the connection was successful.
The neighbor may still reject our connection attempts.
Example:
>>> cjdns.UDPInterface_beginConnection("v0zyvrjuc4xbzh4n9c4k3qpx7kg8xgndv2k45j9nfgb373m8sss0.k", "192.168.0.2:10000", "null")
{'error': 'none'}
>>> cjdns.UDPInterface_beginConnection("v0zyvrjuc4xbzh4n9c4k3qpx7kg8xgndv2k45j9nfgb373m8sss0.k", "x", "null")
{'error': 'unable to parse ip address and port.'}
>>> cjdns.UDPInterface_beginConnection("k", "x", "null")
{'error': 'publicKey is too short, must be 52 characters long.'}
>>> cjdns.UDPInterface_beginConnection("------------------------------------------------------", "x", "null")
{'error': 'failed to parse publicKey.'}
>>> cjdns.UDPInterface_beginConnection("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz0.k", "192.168.0.2:10000", "null")
{'error': 'invalid cjdns public key.'}
>>> cjdns.UDPInterface_beginConnection("v0zyvrjuc4xbzh4n9c4k3qpx7kg8xgndv2k45j9nfgb373m8sss0.k", "[1234::5]:10000", "null")
{'error': 'different address type than this socket is bound to.'}
Since cjdns contains so many logging locations, logging to a file would not only be inefficient but it would fill up your disk rather quickly. Because if this, cjdns logging is only enabled on request, with these functions you can ask for logs to be enabled on a log level, per-file or even per-line basis.
Log levels may be excluded at compile time in which case they will not be available. Each log level implies inclusion of every higher level, if you subscribe to INFO logging, you will also automatically get WARN, ERROR, and CRITICAL.
Cjdns log levels:
To see an implementation of cjdns log consumer, look at contrib/python/cjdnslog
.
Subscribe to logging of a level/file/line.
Auth Required
NOTE: Because this function responds asynchronously, using netcat
or cexec
to call it
will not work, additionally it will stop sending asynchronous messages unless an incoming message
comes in every 10 seconds so you must send periodic messages on the same UDP port.
See: Admin_asyncEnabled()
for more information.
Parameters:
Returns:
none
if all goes well.Log message structure:
["KEYS", "DEBUG", "INFO", "WARN", "ERROR", "CRITICAL"]
AdminLog_subscribe()
.Unsubscribe from logging.
Auth Required
Parameters:
AdminLog_subscribe()
.Returns:
none
if the subscription existed and was removed.Note: If the subscription has already timed out, removing it will yield 'error': 'No such subscription.'
.
Example:
$ ./contrib/python/cexec 'AdminLog_subscribe()'
{'txid': '0EKWEP7VXI', 'streamId': 'f1a0e225183397f4', 'error': 'none'}
$ ./contrib/python/cexec 'AdminLog_unsubscribe("f1a0e225183397f4")'
{'txid': 'CB4V7KLYCC', 'error': 'none'}
These functions are for dealing with the Admin interface, the infrastructure which allows all of the other functions throughout cjdns to be accessed from the admin socket.
Get a list of functions which are available to the admin socket as well as their required and optional parameters, unfortunately their return values are not provided and can only be determined by experimentation or by reading the source.
Note: The list of functions is paged to make sure each message fits inside of a UDP packet, in
order to get the whole list of functions, you must increment the page
parameter until the result
nolonger contains the more
field.
Parameters:
Returns:
Each function description is a Dict of function parameters with the parameter name as the key and
the specifications as the value. The specification required
is an Int which is either 0 meaning
the parameter is optional or 1 meaning it is required. type
is a String which is one of
["Int", "String", "Dict", "List"]
and defines the type which the parameter must be.
'AdminLog_subscribe': {
'line': {
'required': 0,
'type': 'Int'
},
'file': {
'required': 0,
'type': 'String'
},
'level': {
'required': 0,
'type': 'String'
}
}
This function is for determining whether asynchronous communication is allowed. Asynchronous communication, EG: AdminLog responses, is only allowed with clients which satisfy certain requirements.
AdminLog_subscribe()
requires authentication.Admin_asyncEnabled()
).
These calls do not need to be authenticated, there just needs to have been one in history.Returns:
Example:
This example illustrates how using cexec
to call it returns true because cexec
uses
authenticated calls whereas manually calling it without authentication returns false.
$ ./contrib/python/cexec 'Admin_asyncEnabled()'
{'asyncEnabled': 1, 'txid': '74GF0SS2N0'}
echo '{ "q": "Admin_asyncEnabled" }' \
| ./build/benc2json -r \
| tr -d '\n' \
| nc -u 127.0.0.1 11234 \
| ./build/benc2json
{
"asyncEnabled" : 0
}
These functions are available for putting the cjdns core into a sandbox where a security breach within the core would be less likely to cause a total system compromize.
Set the user ID which cjdns is running under to a different user. This function allows cjdns to shed privileges after starting up.
NOTE: This function will always fail with an error about process cannot open more files
if
Security_noFiles()
has already been called.
Parameters:
Return:
none
if all went well, otherwise a description of the failure.Set the hard open file limit to zero, while this does not force closed file descriptors which are already open, it makes any function requiring the opening of a file to fail providing a powerful sandbox. By calling this function after cjdns is started, one can insure that cjdns core cannot touch the filesystem or open network sockets which it does not already have open. This will however prevent a number of other admin API functions fron working.
Returns:
none
Examples:
$ ./contrib/python/cexec 'UDPInterface_new("[::]:2048")'
{'interfaceNumber': 3, 'txid': 'NQGOZXJZIC', 'error': 'none'}
$ ./contrib/python/cexec 'Security_noFiles()'
{'txid': 'CQYQWA5SZY', 'error': 'none'}
$ ./contrib/python/cexec 'UDPInterface_new("[::]:5000")'
{'txid': 'UZH9LIUOG0', 'cause': 'process cannot open more files', 'error': 'call to socket() failed [process cannot open more files]'}
This function is used during cjdns startup to initialize the TUN device, set it's IP address and set the MTU, it is hastily designed and may be removed in the future.
Parameters:
Returns:
none
if all went well, otherwise the error which occured.Note: an error will be returned if anything goes wrong initializing the tunnel, setting it's IP address or setting it's MTU, even if there is an error, the tunnel may work just fine and even if the tunnel doesn't work, cjdns will function as a router only without the TUN device.
A function to stop cjdns.
Returns:
none
before exiting.Returns:
{'q':'pong'}
For checking if the admin connection is functioning.
Auth Required
Parameters:
Returns:
Examples:
>>> print cjdns.RouterModule_lookup('fc5d:baa5:61fc:6ffd:9554:67f0:e290:7535')
{'result': '0000.0000.0000.1953', 'error': 'none'}
>>> print cjdns.RouterModule_lookup('fc5d:baa5:61fc:6ffd:9554:67f0:e290:7536')
{'result': 'fcf1:a7a8:8ec0:589b:c64c:cc95:1ced:3679@0000.0000.0000.0013', 'error': 'none'}
>>> print cjdns.RouterModule_lookup('f')
{'result': '', 'error': 'address wrong length'}
>>> print cjdns.RouterModule_lookup('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz')
{'result': '', 'error': 'failed to parse address'}
Auth Required
Parameters:
1
(only currently supported method).Returns:
none
if everything went well.Specified auth type is not supported.
if the auth type is specified and not 1
.Password already added.
if you try to add the same user or password twice.Out of memory to store password.
if the buffer for storing
authorized passwords is full.Examples:
$ ./contrib/python/cexec 'AuthorizedPasswords_add(user="test",password="yh14wl2ffgcqq6bvut12xrz7g3")'
{'error': 'none'}
$ ./contrib/python/cexec 'AuthorizedPasswords_add(user="test2",password="2yh14wl2ffgcqq6bvut12xrz7g3",authType=300)'
{'error': 'Specified auth type is not supported.'}
$ ./contrib/python/cexec 'AuthorizedPasswords_add(user="test",password="yh14wl2ffgcqq6bvut12xrz7g3")'
{'error': 'Password already added.'}
Auth Required
Get a list of all the authorized users.
Example:
$ ./contrib/python/cexec 'AuthorizedPasswords_list()'
{'total': 2, 'users': ['Test User1', 'Local Peers'], 'txid': 'W0DUG0D50K'}
Get the number of bytes of memory allocated by all memory allocators in the router.
Example:
>>> cjdns.memory()
{'bytes': 779259}
Parameters:
Response:
routingTable
a key which contains a list of dictionaries, each containing ip
,
link
and path
. ip
is the IPv6 address of the node, link
is a unitless number
between 0 inclusive and 2^32 exclusive, representing the router's opinion of the quality of
that path, higher is better. path
is the route to the node.
more
to signal that there is another page of results, the engine will add a more
key
with the integer 1, if there isn't another page of results, the more
key will not be added.
What the data looks like:
{
'routingTable': [
{
'ip': 'fce5:de17:cbde:c87b:5289:0556:8b83:c9c8',
'link': 4294967295,
'path': '0000.0000.0000.0001'
}, {
'ip': 'fcfc:2ebe:346c:7fe7:95af:a58b:2631:dead',
'link': 235149061,
'path': '0000.0000.631a.3b53'
}, {
'ip': 'fc70:772a:f803:7c4e:38bd:981b:f791:60a1',
'link': 271119350,
'path': '0000.0000.017b.b333'
},
..............................
],
'more': 1
}
Example:
>>> cjdns.NodeStore_dumpTable(0)
{'routingTable': [{'ip': 'fce5:de17:cbde:c87b:5289:0556:8b83:c9c8', 'link': 4294967295,....
>>> cjdns.NodeStore_dumpTable(4)
{'routingTable': []}
Auth Required
Send a switch level ping. There is no routing table lookup and the router is not involved. Pinging IP addresses this way is not possible.
Parameters: SwitchPinger_ping(required String path, String data, Int timeout)
0000.0000.04f5.2555
DEFAULT_TIMEOUT
as defined in SwitchPinger_admin.c
(2 seconds).Examples:
>>> cjdns.SwitchPinger_ping('0000.0000.04f5.2555')
{'path': '0000.0000.04f5.2555', 'data': '', 'result': 'pong', 'ms': 281}
>>> cjdns.SwitchPinger_ping('fca5:9fe0:3fa2:d576:71e6:8373:7aeb:ea11')
{'error': 'path was not parsable.'}
>>> cjdns.SwitchPinger_ping('0000.0000.04f5.2555', '12345abcdefg')
{'path': '0000.0000.04f5.2555', 'data': '12345abcdefg', 'result': 'pong', 'ms': 326}
>>> cjdns.SwitchPinger_ping('0000.0000.0405.2555')
{'path': '0000.0000.0405.2555', 'data': '', 'result': 'ping message caused switch error', 'ms': 278}
>>> cjdns.SwitchPinger_ping('0000.0000.04f5.2555', '', 30)
{'result': 'timeout', 'ms': 77}