mirror of
https://github.com/cwinfo/hyperboria-peers.git
synced 2024-11-26 04:51:37 +00:00
Wrap JSON dicts in {} like the rest of the world
Update tests.py, README.md to reflect this tests.py also now checks exact formatting. Must be four spaces indented, etc. Also has --clean option to do it for you
This commit is contained in:
parent
8a63833742
commit
52240ec1e9
@ -1,8 +1,8 @@
|
|||||||
"128.199.246.213:64022":
|
{
|
||||||
{
|
"128.199.246.213:64022":{
|
||||||
|
"contact":"hype@smash-net.org",
|
||||||
"password":"public_access",
|
"password":"public_access",
|
||||||
"publicKey":"ff3yru5mxjf13c4kpw1nys4j6pz9q191cds85srmsnxnql47q5p0.k",
|
"publicKey":"ff3yru5mxjf13c4kpw1nys4j6pz9q191cds85srmsnxnql47q5p0.k",
|
||||||
"user":"weuxel",
|
"user":"weuxel"
|
||||||
"contact": "hype@smash-net.org"
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
"176.9.105.201:4464": {
|
{
|
||||||
|
"176.9.105.201:4464":{
|
||||||
|
"contact":"webmaster@jazzanet.com",
|
||||||
"login":"public",
|
"login":"public",
|
||||||
"password":"ir88xwtel72fen3ch7aug603s26nu3a",
|
"password":"ir88xwtel72fen3ch7aug603s26nu3a",
|
||||||
"publicKey":"yrgb0xwfr9pz8swvnv6m9by8zw7v7uxxhl07qz318cjuvfgs1fc0.k",
|
"peerName":"jazzanet",
|
||||||
"contact":"webmaster@jazzanet.com",
|
"publicKey":"yrgb0xwfr9pz8swvnv6m9by8zw7v7uxxhl07qz318cjuvfgs1fc0.k"
|
||||||
"peerName":"jazzanet"
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"hub.icfreedom.net:64749": {
|
{
|
||||||
"password":")h.1-_[?bFW!0H:O{=a>H+9&17q]*j1~Bjzk{e.$",
|
"hub.icfreedom.net:64749":{
|
||||||
"publicKey":"ny90t66vzmfywtcs3rs8fwwhzfk7frgvdfxutqxslk18jrj82hx0.k",
|
|
||||||
"contact":"mixxit@hyperboria.name",
|
"contact":"mixxit@hyperboria.name",
|
||||||
"peerName":"icfreedom.net"
|
"password":")h.1-_[?bFW!0H:O{=a>H+9&17q]*j1~Bjzk{e.$",
|
||||||
|
"peerName":"icfreedom.net",
|
||||||
|
"publicKey":"ny90t66vzmfywtcs3rs8fwwhzfk7frgvdfxutqxslk18jrj82hx0.k"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"51.254.25.16:1132": {
|
{
|
||||||
"password":"thah9aePha1Vusha6ovhpublic",
|
"51.254.25.16:1132":{
|
||||||
"publicKey":"kw0vfw3tmb6u6p21z5jmmymdlumwknlg3x8muk5mcw66tdpqlw30.k",
|
|
||||||
"contact":"me@magik6k.net",
|
"contact":"me@magik6k.net",
|
||||||
"peerName":"Magik6k-sbg1"
|
"password":"thah9aePha1Vusha6ovhpublic",
|
||||||
|
"peerName":"Magik6k-sbg1",
|
||||||
|
"publicKey":"kw0vfw3tmb6u6p21z5jmmymdlumwknlg3x8muk5mcw66tdpqlw30.k"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
"rethymno-meshnet.tk:38295": {
|
{
|
||||||
"login": "default-login",
|
"rethymno-meshnet.tk:38295":{
|
||||||
|
"contact":"kaotisk@irc.fc00.io",
|
||||||
|
"login":"default-login",
|
||||||
"password":"wgs9k7n7j5yh0kx7kyl5m7cpp71ls4y",
|
"password":"wgs9k7n7j5yh0kx7kyl5m7cpp71ls4y",
|
||||||
"publicKey":"wb3pt76psbt28mt9t2wzyudyh9zkqwq9z3jqb3t06y53g6f5qzh0.k",
|
|
||||||
"peerName":"gr-rethymno-meshnet",
|
"peerName":"gr-rethymno-meshnet",
|
||||||
"contact":"kaotisk@irc.fc00.io"
|
"publicKey":"wb3pt76psbt28mt9t2wzyudyh9zkqwq9z3jqb3t06y53g6f5qzh0.k"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"188.166.3.174:4841":{
|
{
|
||||||
|
"188.166.3.174:4841":{
|
||||||
|
"contact":"oniichan@mrowr.me",
|
||||||
"password":"public-20150903-6pb6aEKDDKVr9zsBJIyDUYfrXYzQv1",
|
"password":"public-20150903-6pb6aEKDDKVr9zsBJIyDUYfrXYzQv1",
|
||||||
"publicKey":"s680fh7g69ww3y9cmrxt910u5hvrwrmcnln1sz6mq1jk5mquq8k0.k",
|
"publicKey":"s680fh7g69ww3y9cmrxt910u5hvrwrmcnln1sz6mq1jk5mquq8k0.k",
|
||||||
"user":"katt",
|
"user":"katt"
|
||||||
"contact":"oniichan@mrowr.me"
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
"188.226.183.183:43328": {
|
{
|
||||||
|
"188.226.183.183:43328":{
|
||||||
|
"contact":"hype@smash-net.org",
|
||||||
"password":"public_access",
|
"password":"public_access",
|
||||||
"publicKey":"1y1jmqrw4r31jlp6yqmq30067rcp0tsgsdm3cs4k8l33pyfhpwn0.k",
|
"publicKey":"1y1jmqrw4r31jlp6yqmq30067rcp0tsgsdm3cs4k8l33pyfhpwn0.k",
|
||||||
"user":"weuxel",
|
"user":"weuxel"
|
||||||
"contact": "hype@smash-net.org"
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
"185.125.216.67:24297": {
|
{
|
||||||
"login": "default-login",
|
"185.125.216.67:24297":{
|
||||||
|
"contact":"contact@bunjlabs.com",
|
||||||
|
"login":"default-login",
|
||||||
"password":"c5q2j63x5nkmt2yg2vjmlnfuh1jnjjf",
|
"password":"c5q2j63x5nkmt2yg2vjmlnfuh1jnjjf",
|
||||||
"publicKey":"5dkw4x4tczb6x164qklggbgfy35cs5uxjl6tyyu4slu7nm4062q0.k",
|
|
||||||
"peerName":"h.bunjlabs.com",
|
"peerName":"h.bunjlabs.com",
|
||||||
"contact":"contact@bunjlabs.com"
|
"publicKey":"5dkw4x4tczb6x164qklggbgfy35cs5uxjl6tyyu4slu7nm4062q0.k"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
"leeloo.kyriasis.com:65149": {
|
{
|
||||||
"login": "public-peer",
|
"leeloo.kyriasis.com:65149":{
|
||||||
"password": "3fPUWtOiQfKRupM7y9zIAdZhbLiaumoCutVJx9Igw/bZerEhbOfDdEFxJZojcnw0jMcOR/dZvFElmqI6",
|
"contact":"johannes@kyriasis.com",
|
||||||
"publicKey": "4dhktl7cmwp0f1grjuhn1m5gg3tllx1mccssmgq2s6xqltzpu620.k",
|
"gpg":"50FB9B273A9D0BB5",
|
||||||
"contact": "johannes@kyriasis.com",
|
"login":"public-peer",
|
||||||
"gpg": "50FB9B273A9D0BB5",
|
"password":"3fPUWtOiQfKRupM7y9zIAdZhbLiaumoCutVJx9Igw/bZerEhbOfDdEFxJZojcnw0jMcOR/dZvFElmqI6",
|
||||||
"peerName": "leeloo.kyriasis.com"
|
"peerName":"leeloo.kyriasis.com",
|
||||||
|
"publicKey":"4dhktl7cmwp0f1grjuhn1m5gg3tllx1mccssmgq2s6xqltzpu620.k"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
"139.162.219.143:2331":{
|
{
|
||||||
|
"139.162.219.143:2331":{
|
||||||
|
"contact":"ansuz@transitiontech.ca",
|
||||||
"password":"CJ36KhxxO7nmfCy1kVB27rhwlWgnG95i",
|
"password":"CJ36KhxxO7nmfCy1kVB27rhwlWgnG95i",
|
||||||
"publicKey":"bddc5j6sc45hlrdnccu120zwnmm2z0qlbfkxn9n8xbs0vqgx9fh0.k",
|
"publicKey":"bddc5j6sc45hlrdnccu120zwnmm2z0qlbfkxn9n8xbs0vqgx9fh0.k",
|
||||||
"user":"ansuz",
|
"user":"ansuz"
|
||||||
"contact":"ansuz@transitiontech.ca"
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
"142.4.212.42:1441": {
|
{
|
||||||
|
"142.4.212.42:1441":{
|
||||||
|
"contact":"derp@projectmeshnet.org",
|
||||||
"password":"201510034nnmj97n54nby3797xt227lr0538ty4",
|
"password":"201510034nnmj97n54nby3797xt227lr0538ty4",
|
||||||
"publicKey":"9uf222z95bxd7sgvncdtzr2skgjp7vdr472f7u74pc0zxu0pjxl0.k",
|
"publicKey":"9uf222z95bxd7sgvncdtzr2skgjp7vdr472f7u74pc0zxu0pjxl0.k",
|
||||||
"user": "derp",
|
"user":"derp"
|
||||||
"contact": "derp@projectmeshnet.org"
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
"192.169.7.142:14400":{
|
{
|
||||||
|
"192.169.7.142:14400":{
|
||||||
"contact":"Igel@hyperboria.ca",
|
"contact":"Igel@hyperboria.ca",
|
||||||
"gpg":"A84DFFE62B451511",
|
"gpg":"A84DFFE62B451511",
|
||||||
"peerName":"igel-losangeles",
|
|
||||||
"password":"alfa-charlie-alfa-bravo",
|
"password":"alfa-charlie-alfa-bravo",
|
||||||
|
"peerName":"igel-losangeles",
|
||||||
"publicKey":"mh9m0411cfcg7xhdc8n6ckls1tjgnvvbdfzdgqf5196tfkw96rr0.k"
|
"publicKey":"mh9m0411cfcg7xhdc8n6ckls1tjgnvvbdfzdgqf5196tfkw96rr0.k"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
"107.170.57.34:63472": {
|
{
|
||||||
"login": "public-peer",
|
"107.170.57.34:63472":{
|
||||||
"password":"ppm6j89mgvss7uvtntcd9scy6166mwb",
|
|
||||||
"publicKey":"1xkf13m9r9h502yuffsq1cg13s5648bpxrtf2c3xcq1mlj893s90.k",
|
|
||||||
"peerName":"Jacob Henner",
|
|
||||||
"contact":"code@ventricle.us",
|
"contact":"code@ventricle.us",
|
||||||
"location":"digitalocean nyc2"
|
"location":"digitalocean nyc2",
|
||||||
},
|
"login":"public-peer",
|
||||||
"[2604:a880:0:1010::f:4001]:63472": {
|
|
||||||
"login": "public-peer",
|
|
||||||
"password":"ppm6j89mgvss7uvtntcd9scy6166mwb",
|
"password":"ppm6j89mgvss7uvtntcd9scy6166mwb",
|
||||||
"publicKey":"1xkf13m9r9h502yuffsq1cg13s5648bpxrtf2c3xcq1mlj893s90.k",
|
|
||||||
"peerName":"Jacob Henner",
|
"peerName":"Jacob Henner",
|
||||||
|
"publicKey":"1xkf13m9r9h502yuffsq1cg13s5648bpxrtf2c3xcq1mlj893s90.k"
|
||||||
|
},
|
||||||
|
"[2604:a880:0:1010::f:4001]:63472":{
|
||||||
"contact":"code@ventricle.us",
|
"contact":"code@ventricle.us",
|
||||||
"location":"digitalocean nyc2"
|
"location":"digitalocean nyc2",
|
||||||
|
"login":"public-peer",
|
||||||
|
"password":"ppm6j89mgvss7uvtntcd9scy6166mwb",
|
||||||
|
"peerName":"Jacob Henner",
|
||||||
|
"publicKey":"1xkf13m9r9h502yuffsq1cg13s5648bpxrtf2c3xcq1mlj893s90.k"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
"192.241.171.154:62718": {
|
{
|
||||||
|
"192.241.171.154:62718":{
|
||||||
|
"contact":"hype@smash-net.org",
|
||||||
"password":"public_access",
|
"password":"public_access",
|
||||||
"publicKey":"q5nhj9kg6ddmk571jb259mct2ljd10z9xvyf05y3hu66wk4qnk20.k",
|
"publicKey":"q5nhj9kg6ddmk571jb259mct2ljd10z9xvyf05y3hu66wk4qnk20.k",
|
||||||
"user":"weuxel",
|
"user":"weuxel"
|
||||||
"contact": "hype@smash-net.org"
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
"192.198.82.242:27823":{
|
{
|
||||||
|
"192.198.82.242:27823":{
|
||||||
"contact":"Igel@hyperboria.ca",
|
"contact":"Igel@hyperboria.ca",
|
||||||
"gpg":"A84DFFE62B451511",
|
"gpg":"A84DFFE62B451511",
|
||||||
"peerName":"igel-northcarolina",
|
|
||||||
"password":"alfa-charlie-alfa-bravo",
|
"password":"alfa-charlie-alfa-bravo",
|
||||||
|
"peerName":"igel-northcarolina",
|
||||||
"publicKey":"1nctdb89gtfrlnu71zyq97n14frl1r4z0ylwzc8vn7kpvrzu4yl0.k"
|
"publicKey":"1nctdb89gtfrlnu71zyq97n14frl1r4z0ylwzc8vn7kpvrzu4yl0.k"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
"173.62.245.186:55249": {
|
{
|
||||||
"peerName": "NAT",
|
"173.62.245.186:55249":{
|
||||||
"ipv6": "fcda:9958:9093:49f2:2677:6df6:2a5a:b01d",
|
"contact":"natebrune@gmail.com",
|
||||||
"country": "us",
|
"country":"us",
|
||||||
"website": "https://github.com/NateBrune",
|
"gpg":"C95CE6BC6735BAD7",
|
||||||
"contact": "natebrune@gmail.com",
|
"ipv6":"fcda:9958:9093:49f2:2677:6df6:2a5a:b01d",
|
||||||
"gpg": "C95CE6BC6735BAD7",
|
"password":"Public",
|
||||||
"publicKey": "vgxqyputh4ldhxktg9msmr61pw938l0ymhkmryljsyzvmr0dtwy0.k",
|
"peerName":"NAT",
|
||||||
"password": "Public"
|
"publicKey":"vgxqyputh4ldhxktg9msmr61pw938l0ymhkmryljsyzvmr0dtwy0.k",
|
||||||
|
"website":"https://github.com/NateBrune"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ By following this scheme, we make it possible for users to programmatically find
|
|||||||
|
|
||||||
## JSON formatting
|
## JSON formatting
|
||||||
|
|
||||||
* Your credentials must be [valid JSON](http://jsonlint.com/) when inserted into a block of curly braces `{}`
|
* Your credentials must be [valid JSON](http://jsonlint.com/).
|
||||||
* They should be small enough so as to be inserted into a `cjdroute.conf` **as is** without triggering the [connectTo-overflow bug](https://github.com/hyperboria/docs/blob/master/bugs/connectTo-overflow.md).
|
* They should be small enough so as to be inserted into a `cjdroute.conf` **as is** without triggering the [connectTo-overflow bug](https://github.com/hyperboria/docs/blob/master/bugs/connectTo-overflow.md).
|
||||||
* They must contain the necessary fields:
|
* They must contain the necessary fields:
|
||||||
+ ip/port
|
+ ip/port
|
||||||
@ -56,17 +56,16 @@ By following this scheme, we make it possible for users to programmatically find
|
|||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
"192.168.1.5:10326": {
|
{
|
||||||
|
"192.168.1.5:10326": {
|
||||||
"login": "default-login",
|
"login": "default-login",
|
||||||
"password":"nq1uhmf06k8c5594jqmpgy26813b81s",
|
"password":"nq1uhmf06k8c5594jqmpgy26813b81s",
|
||||||
"publicKey":"ssxlh80x0bqjfrnbkm1801xsxyd8zd45jkwn1zhlnccqj4hdqun0.k",
|
"publicKey":"ssxlh80x0bqjfrnbkm1801xsxyd8zd45jkwn1zhlnccqj4hdqun0.k",
|
||||||
"peerName":"your-name-goes-here"
|
"peerName":"your-name-goes-here"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: the snippet above is **not valid json**. It would need to be wrapped in an additional block of curly braces `{ }`
|
|
||||||
|
|
||||||
## Naming your entry
|
## Naming your entry
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
28
tests.py
28
tests.py
@ -18,9 +18,20 @@ def validate(path):
|
|||||||
print("Validating %s" % path)
|
print("Validating %s" % path)
|
||||||
try:
|
try:
|
||||||
creds = open(path).read()
|
creds = open(path).read()
|
||||||
peers = json.loads("{%s}" % creds)
|
peers = json.loads(creds)
|
||||||
|
# Check formatting
|
||||||
|
pretty = json.dumps(peers, sort_keys=True, indent=4, separators=(',', ':'))
|
||||||
|
pretty = "%s\n" % pretty
|
||||||
|
formatting = True
|
||||||
|
if pretty != creds:
|
||||||
|
if "--clean" in sys.argv:
|
||||||
|
with open(path, 'w') as outfile:
|
||||||
|
outfile.write(pretty)
|
||||||
|
print(" %sJSON in %s has been fixed.%s" % (YELLOW, path, END))
|
||||||
|
else:
|
||||||
|
print(" %sJSON in %s is NOT properly formatted.%s" % (YELLOW, path, END))
|
||||||
|
formatting = False
|
||||||
hosts = peers.keys()
|
hosts = peers.keys()
|
||||||
warning = False
|
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
for field in REQUIRED_FIELDS:
|
for field in REQUIRED_FIELDS:
|
||||||
if field not in peers[host]:
|
if field not in peers[host]:
|
||||||
@ -29,27 +40,20 @@ def validate(path):
|
|||||||
return False
|
return False
|
||||||
for field in RECOMMENDED_FIELDS:
|
for field in RECOMMENDED_FIELDS:
|
||||||
if field not in peers[host]:
|
if field not in peers[host]:
|
||||||
warning = True
|
|
||||||
print(" %sHost %s is missing the recommended field %s%s" % (YELLOW, host,
|
print(" %sHost %s is missing the recommended field %s%s" % (YELLOW, host,
|
||||||
field, END))
|
field, END))
|
||||||
if warning:
|
if not formatting:
|
||||||
print(" %sSuccess, but missing recommended fields%s" % (YELLOW, END))
|
return False
|
||||||
else:
|
|
||||||
print(" %sSuccess!%s" % (YELLOW, END))
|
|
||||||
return True
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print(" %sInvalid JSON!%s" % (RED, END))
|
print(" %sInvalid JSON!%s" % (RED, END))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
success = True
|
success = True
|
||||||
if len(sys.argv) == 2:
|
|
||||||
success = validate(sys.argv[1])
|
|
||||||
else:
|
|
||||||
for directory, subdirs, files in os.walk('.'):
|
for directory, subdirs, files in os.walk('.'):
|
||||||
if len(files) > 0:
|
if len(files) > 0:
|
||||||
|
if directory != '.' and not directory.startswith('./.git'):
|
||||||
for f in files:
|
for f in files:
|
||||||
if f.endswith('.k'):
|
|
||||||
result = validate("%s/%s" % (directory, f))
|
result = validate("%s/%s" % (directory, f))
|
||||||
if not result:
|
if not result:
|
||||||
success = False
|
success = False
|
||||||
|
Loading…
Reference in New Issue
Block a user