Council
Fetch suitable hosts for any protocol
Client
const plugin = require('ilp-plugin')()
const council = require('council')({ plugin })
async function run () {
console.log('hosts for org.codius:', await council('org.codius'))
}
run()
The client will take COUNCIL_HOSTS
from the environment (containing a
comma-separated list of hosts), or the module can take a second hosts
parameter alongside plugin
. hosts
must be an array.
Server
$ DEBUG=* COUNCIL_CONFIG=../example-config.json COUNCIL_PORT=8002 node ./server/index.js &
$ ILP_CREDENTIALS='{"secret":"spkemkgDWHwZrJ88HNs7xd1wjT6Xu","server":"wss://s.altnet.rippletest.net:51233"}' DEBUG=* COUNCIL_CONFIG=../example-config-2.json COUNCIL_PORT=8001 node ./server/index.js &
$ ilp-curl -X GET localhost:8002/hosts/org.codius
[ { host: 'codius.org', depth: 1 } ]
$ ilp-curl -X GET localhost:8001/hosts/com.sharafian.sms
[ { host: 'twilio.com', depth: 1 },
{ host: 'google.com', depth: 1 } ]
$ ilp-curl -X GET localhost:8002/hosts/com.sharafian.sms
[ { host: 'twilio.com', depth: 2 },
{ host: 'google.com', depth: 2 } ]