2015-12-30 21:38:37 +00:00
# peers [![Build Status](https://secure.travis-ci.org/hyperboria/peers.png)](http://travis-ci.org/hyperboria/peers)
2016-06-19 09:26:49 +00:00
A geographically sorted list of public peering credentials for joining [Hyperboria ](https://hyperboria.net/ ).
2015-10-03 20:08:52 +00:00
2016-06-19 09:26:49 +00:00
Hyperboria uses [cjdns ](https://github.com/cjdelisle/cjdns ) to construct an end-to-end-encrypted ipv6 mesh network.
Connections between nodes are established manually, and traffic is restricted to the resulting social graph.
2015-11-18 18:50:06 +00:00
2016-06-19 09:26:49 +00:00
This repository exists for those who don't already know somebody on Hyperboria.
2015-11-18 18:50:06 +00:00
2016-06-19 09:26:49 +00:00
## Adding your public node's credentials
2015-11-18 18:50:06 +00:00
2016-06-19 09:26:49 +00:00
If you've created a public node, and would like to have it listed here, fork the repo, add a keyfile, and submit a PR.
2015-11-18 18:50:06 +00:00
2016-06-19 09:26:49 +00:00
### Filepath conventions
Credentials are sorted geographically, by [continent ](https://github.com/hyperboria/docs/blob/master/cjdns/nodeinfo-json.md#regarding-continent-codes ), region, and municipality.
2015-11-18 18:50:06 +00:00
2016-06-19 09:26:49 +00:00
For example, a node in New York City is listed at `NA/us/newyork` .
2015-11-18 18:50:06 +00:00
2016-06-19 09:26:49 +00:00
Region and municipality codes are based on self identification, not any ISO standard.
An operator might prefer to list their node in Cascadia instead of Washington state.
For simplicity's sake, we'd prefer that new credentials conform to existing structures.
2015-11-18 18:50:06 +00:00
2016-06-19 09:26:49 +00:00
### JSON formatting
2015-11-18 18:50:06 +00:00
2016-06-19 09:26:49 +00:00
We have tried to standardize the structure of the actual credential files, as such, they have the strictest requirements of anything in this repository.
2015-11-18 18:50:06 +00:00
2016-03-13 17:46:55 +00:00
* Your credentials must be [valid JSON ](http://jsonlint.com/ ).
2015-11-18 18:50:06 +00:00
* They must contain the necessary fields:
+ ip/port
+ password
+ publicKey
2016-06-12 09:52:12 +00:00
+ contact (a means of contacting the operator)
2016-06-19 09:26:49 +00:00
* credentials should be formatted such that:
- there is a space after each colon
- indentation uses four spaces
- the file ends with a newline character.
2015-11-18 18:50:06 +00:00
```
2016-03-13 17:46:55 +00:00
{
"192.168.1.5:10326": {
"login": "default-login",
2016-06-19 09:26:49 +00:00
"password": "nq1uhmf06k8c5594jqmpgy26813b81s",
"publicKey": "ssxlh80x0bqjfrnbkm1801xsxyd8zd45jkwn1zhlnccqj4hdqun0.k",
"peerName": "your-name-goes-here"
2016-03-13 17:46:55 +00:00
}
2015-11-18 18:50:06 +00:00
}
```
2016-06-19 09:26:49 +00:00
### Naming your entry
2015-11-18 18:50:06 +00:00
2016-06-19 08:16:08 +00:00
Credential files must end with `.k` .
2016-06-19 09:26:49 +00:00
Otherwise, you can name your file whatever you want, but for simplicity's sake, avoid characters which will need to be escaped at the command line (or within the javascript api).
2016-06-19 08:16:08 +00:00
2016-06-19 08:51:53 +00:00
## Javascript API
Peering credentials in this repository can be accessed via a simple Javascript API (using Nodejs).
It's available as a module on npm:
`npm install hyperboria-peers`
### Usage
```Javascript
2016-06-19 09:52:33 +00:00
var Peers = require("hyperboria-peers");
2016-06-19 08:51:53 +00:00
/* return a list of public peers located in North America */
Peers.filter(function (creds, path) {
return path.indexOf('NA') !== -1;
});
/* return a list of public keys */
Peers.map(function (creds, path) {
return creds[Object.keys(creds)[0]].publicKey;
});
/* the underlying data is exposed in a nested json structure */
console.log(Peers.peers);
console.log(Peers.peers.NA.us.california);
```