diff --git a/AS/sg/singapore/weuxel.sing.k b/AS/sg/singapore/weuxel.sing.k index e76c905..18280fb 100644 --- a/AS/sg/singapore/weuxel.sing.k +++ b/AS/sg/singapore/weuxel.sing.k @@ -1,8 +1,8 @@ -"128.199.246.213:64022": - { - "password":"public_access", - "publicKey":"ff3yru5mxjf13c4kpw1nys4j6pz9q191cds85srmsnxnql47q5p0.k", - "user":"weuxel", - "contact": "hype@smash-net.org" - } - +{ + "128.199.246.213:64022":{ + "contact":"hype@smash-net.org", + "password":"public_access", + "publicKey":"ff3yru5mxjf13c4kpw1nys4j6pz9q191cds85srmsnxnql47q5p0.k", + "user":"weuxel" + } +} diff --git a/EU/de/bavaria/hype.jazzanet.com.k b/EU/de/bavaria/hype.jazzanet.com.k index 88606ff..bb27a61 100644 --- a/EU/de/bavaria/hype.jazzanet.com.k +++ b/EU/de/bavaria/hype.jazzanet.com.k @@ -1,8 +1,9 @@ -"176.9.105.201:4464": { - "login":"public", - "password":"ir88xwtel72fen3ch7aug603s26nu3a", - "publicKey":"yrgb0xwfr9pz8swvnv6m9by8zw7v7uxxhl07qz318cjuvfgs1fc0.k", - "contact":"webmaster@jazzanet.com", - "peerName":"jazzanet" +{ + "176.9.105.201:4464":{ + "contact":"webmaster@jazzanet.com", + "login":"public", + "password":"ir88xwtel72fen3ch7aug603s26nu3a", + "peerName":"jazzanet", + "publicKey":"yrgb0xwfr9pz8swvnv6m9by8zw7v7uxxhl07qz318cjuvfgs1fc0.k" + } } - diff --git a/EU/fr/nord-pas-de-calais/hub.icfreedom.net.k b/EU/fr/nord-pas-de-calais/hub.icfreedom.net.k index be35a25..1dbe49e 100644 --- a/EU/fr/nord-pas-de-calais/hub.icfreedom.net.k +++ b/EU/fr/nord-pas-de-calais/hub.icfreedom.net.k @@ -1,6 +1,8 @@ -"hub.icfreedom.net:64749": { - "password":")h.1-_[?bFW!0H:O{=a>H+9&17q]*j1~Bjzk{e.$", - "publicKey":"ny90t66vzmfywtcs3rs8fwwhzfk7frgvdfxutqxslk18jrj82hx0.k", - "contact":"mixxit@hyperboria.name", - "peerName":"icfreedom.net" +{ + "hub.icfreedom.net:64749":{ + "contact":"mixxit@hyperboria.name", + "password":")h.1-_[?bFW!0H:O{=a>H+9&17q]*j1~Bjzk{e.$", + "peerName":"icfreedom.net", + "publicKey":"ny90t66vzmfywtcs3rs8fwwhzfk7frgvdfxutqxslk18jrj82hx0.k" + } } diff --git a/EU/fr/strasbourg/magik6k.net.k b/EU/fr/strasbourg/magik6k.net.k index 9a1b9e7..8160f7d 100644 --- a/EU/fr/strasbourg/magik6k.net.k +++ b/EU/fr/strasbourg/magik6k.net.k @@ -1,6 +1,8 @@ -"51.254.25.16:1132": { - "password":"thah9aePha1Vusha6ovhpublic", - "publicKey":"kw0vfw3tmb6u6p21z5jmmymdlumwknlg3x8muk5mcw66tdpqlw30.k", - "contact":"me@magik6k.net", - "peerName":"Magik6k-sbg1" +{ + "51.254.25.16:1132":{ + "contact":"me@magik6k.net", + "password":"thah9aePha1Vusha6ovhpublic", + "peerName":"Magik6k-sbg1", + "publicKey":"kw0vfw3tmb6u6p21z5jmmymdlumwknlg3x8muk5mcw66tdpqlw30.k" + } } diff --git a/EU/gr/rethymno/kaotisk.rethymno-meshnet.k b/EU/gr/rethymno/kaotisk.rethymno-meshnet.k index 237a807..b54ea39 100644 --- a/EU/gr/rethymno/kaotisk.rethymno-meshnet.k +++ b/EU/gr/rethymno/kaotisk.rethymno-meshnet.k @@ -1,7 +1,9 @@ -"rethymno-meshnet.tk:38295": { - "login": "default-login", - "password":"wgs9k7n7j5yh0kx7kyl5m7cpp71ls4y", - "publicKey":"wb3pt76psbt28mt9t2wzyudyh9zkqwq9z3jqb3t06y53g6f5qzh0.k", - "peerName":"gr-rethymno-meshnet", - "contact":"kaotisk@irc.fc00.io" +{ + "rethymno-meshnet.tk:38295":{ + "contact":"kaotisk@irc.fc00.io", + "login":"default-login", + "password":"wgs9k7n7j5yh0kx7kyl5m7cpp71ls4y", + "peerName":"gr-rethymno-meshnet", + "publicKey":"wb3pt76psbt28mt9t2wzyudyh9zkqwq9z3jqb3t06y53g6f5qzh0.k" + } } diff --git a/EU/nl/amsterdam/mrowr.me.k b/EU/nl/amsterdam/mrowr.me.k index 844d8dc..1360685 100644 --- a/EU/nl/amsterdam/mrowr.me.k +++ b/EU/nl/amsterdam/mrowr.me.k @@ -1,6 +1,8 @@ -"188.166.3.174:4841":{ - "password":"public-20150903-6pb6aEKDDKVr9zsBJIyDUYfrXYzQv1", - "publicKey":"s680fh7g69ww3y9cmrxt910u5hvrwrmcnln1sz6mq1jk5mquq8k0.k", - "user":"katt", - "contact":"oniichan@mrowr.me" +{ + "188.166.3.174:4841":{ + "contact":"oniichan@mrowr.me", + "password":"public-20150903-6pb6aEKDDKVr9zsBJIyDUYfrXYzQv1", + "publicKey":"s680fh7g69ww3y9cmrxt910u5hvrwrmcnln1sz6mq1jk5mquq8k0.k", + "user":"katt" + } } diff --git a/EU/nl/amsterdam/weuxel.ams.k b/EU/nl/amsterdam/weuxel.ams.k index e98aeb3..9727c90 100644 --- a/EU/nl/amsterdam/weuxel.ams.k +++ b/EU/nl/amsterdam/weuxel.ams.k @@ -1,7 +1,8 @@ -"188.226.183.183:43328": { - "password":"public_access", - "publicKey":"1y1jmqrw4r31jlp6yqmq30067rcp0tsgsdm3cs4k8l33pyfhpwn0.k", - "user":"weuxel", - "contact": "hype@smash-net.org" +{ + "188.226.183.183:43328":{ + "contact":"hype@smash-net.org", + "password":"public_access", + "publicKey":"1y1jmqrw4r31jlp6yqmq30067rcp0tsgsdm3cs4k8l33pyfhpwn0.k", + "user":"weuxel" + } } - diff --git a/EU/ru/moscow/h.bunjlabs.com.k b/EU/ru/moscow/h.bunjlabs.com.k index 5f5146f..2edd243 100644 --- a/EU/ru/moscow/h.bunjlabs.com.k +++ b/EU/ru/moscow/h.bunjlabs.com.k @@ -1,7 +1,9 @@ -"185.125.216.67:24297": { - "login": "default-login", - "password":"c5q2j63x5nkmt2yg2vjmlnfuh1jnjjf", - "publicKey":"5dkw4x4tczb6x164qklggbgfy35cs5uxjl6tyyu4slu7nm4062q0.k", - "peerName":"h.bunjlabs.com", - "contact":"contact@bunjlabs.com" +{ + "185.125.216.67:24297":{ + "contact":"contact@bunjlabs.com", + "login":"default-login", + "password":"c5q2j63x5nkmt2yg2vjmlnfuh1jnjjf", + "peerName":"h.bunjlabs.com", + "publicKey":"5dkw4x4tczb6x164qklggbgfy35cs5uxjl6tyyu4slu7nm4062q0.k" + } } diff --git a/EU/se/stockholm/leeloo.kyriasis.com.k b/EU/se/stockholm/leeloo.kyriasis.com.k index 57e7e40..43552c9 100644 --- a/EU/se/stockholm/leeloo.kyriasis.com.k +++ b/EU/se/stockholm/leeloo.kyriasis.com.k @@ -1,8 +1,10 @@ -"leeloo.kyriasis.com:65149": { - "login": "public-peer", - "password": "3fPUWtOiQfKRupM7y9zIAdZhbLiaumoCutVJx9Igw/bZerEhbOfDdEFxJZojcnw0jMcOR/dZvFElmqI6", - "publicKey": "4dhktl7cmwp0f1grjuhn1m5gg3tllx1mccssmgq2s6xqltzpu620.k", - "contact": "johannes@kyriasis.com", - "gpg": "50FB9B273A9D0BB5", - "peerName": "leeloo.kyriasis.com" +{ + "leeloo.kyriasis.com:65149":{ + "contact":"johannes@kyriasis.com", + "gpg":"50FB9B273A9D0BB5", + "login":"public-peer", + "password":"3fPUWtOiQfKRupM7y9zIAdZhbLiaumoCutVJx9Igw/bZerEhbOfDdEFxJZojcnw0jMcOR/dZvFElmqI6", + "peerName":"leeloo.kyriasis.com", + "publicKey":"4dhktl7cmwp0f1grjuhn1m5gg3tllx1mccssmgq2s6xqltzpu620.k" + } } diff --git a/EU/uk/london/ansuz.science.k b/EU/uk/london/ansuz.science.k index dbcd4cf..81ae3c4 100644 --- a/EU/uk/london/ansuz.science.k +++ b/EU/uk/london/ansuz.science.k @@ -1,6 +1,8 @@ -"139.162.219.143:2331":{ - "password":"CJ36KhxxO7nmfCy1kVB27rhwlWgnG95i", - "publicKey":"bddc5j6sc45hlrdnccu120zwnmm2z0qlbfkxn9n8xbs0vqgx9fh0.k", - "user":"ansuz", - "contact":"ansuz@transitiontech.ca" +{ + "139.162.219.143:2331":{ + "contact":"ansuz@transitiontech.ca", + "password":"CJ36KhxxO7nmfCy1kVB27rhwlWgnG95i", + "publicKey":"bddc5j6sc45hlrdnccu120zwnmm2z0qlbfkxn9n8xbs0vqgx9fh0.k", + "user":"ansuz" + } } diff --git a/NA/ca/beauharnois/derp.fusion.k b/NA/ca/beauharnois/derp.fusion.k index be8831c..2de2e70 100644 --- a/NA/ca/beauharnois/derp.fusion.k +++ b/NA/ca/beauharnois/derp.fusion.k @@ -1,7 +1,8 @@ -"142.4.212.42:1441": { - "password":"201510034nnmj97n54nby3797xt227lr0538ty4", - "publicKey":"9uf222z95bxd7sgvncdtzr2skgjp7vdr472f7u74pc0zxu0pjxl0.k", - "user": "derp", - "contact": "derp@projectmeshnet.org" +{ + "142.4.212.42:1441":{ + "contact":"derp@projectmeshnet.org", + "password":"201510034nnmj97n54nby3797xt227lr0538ty4", + "publicKey":"9uf222z95bxd7sgvncdtzr2skgjp7vdr472f7u74pc0zxu0pjxl0.k", + "user":"derp" + } } - diff --git a/NA/us/california/igel-california.usa.k b/NA/us/california/igel-california.usa.k index a782fd8..8c2ecfc 100644 --- a/NA/us/california/igel-california.usa.k +++ b/NA/us/california/igel-california.usa.k @@ -1,7 +1,9 @@ -"192.169.7.142:14400":{ - "contact":"Igel@hyperboria.ca", - "gpg":"A84DFFE62B451511", - "peerName":"igel-losangeles", - "password":"alfa-charlie-alfa-bravo", - "publicKey":"mh9m0411cfcg7xhdc8n6ckls1tjgnvvbdfzdgqf5196tfkw96rr0.k" +{ + "192.169.7.142:14400":{ + "contact":"Igel@hyperboria.ca", + "gpg":"A84DFFE62B451511", + "password":"alfa-charlie-alfa-bravo", + "peerName":"igel-losangeles", + "publicKey":"mh9m0411cfcg7xhdc8n6ckls1tjgnvvbdfzdgqf5196tfkw96rr0.k" + } } diff --git a/NA/us/newyork/jacobhenner.usa.k b/NA/us/newyork/jacobhenner.usa.k index 55a4ea3..183e526 100644 --- a/NA/us/newyork/jacobhenner.usa.k +++ b/NA/us/newyork/jacobhenner.usa.k @@ -1,16 +1,18 @@ -"107.170.57.34:63472": { - "login": "public-peer", - "password":"ppm6j89mgvss7uvtntcd9scy6166mwb", - "publicKey":"1xkf13m9r9h502yuffsq1cg13s5648bpxrtf2c3xcq1mlj893s90.k", - "peerName":"Jacob Henner", - "contact":"code@ventricle.us", - "location":"digitalocean nyc2" -}, -"[2604:a880:0:1010::f:4001]:63472": { - "login": "public-peer", - "password":"ppm6j89mgvss7uvtntcd9scy6166mwb", - "publicKey":"1xkf13m9r9h502yuffsq1cg13s5648bpxrtf2c3xcq1mlj893s90.k", - "peerName":"Jacob Henner", - "contact":"code@ventricle.us", - "location":"digitalocean nyc2" +{ + "107.170.57.34:63472":{ + "contact":"code@ventricle.us", + "location":"digitalocean nyc2", + "login":"public-peer", + "password":"ppm6j89mgvss7uvtntcd9scy6166mwb", + "peerName":"Jacob Henner", + "publicKey":"1xkf13m9r9h502yuffsq1cg13s5648bpxrtf2c3xcq1mlj893s90.k" + }, + "[2604:a880:0:1010::f:4001]:63472":{ + "contact":"code@ventricle.us", + "location":"digitalocean nyc2", + "login":"public-peer", + "password":"ppm6j89mgvss7uvtntcd9scy6166mwb", + "peerName":"Jacob Henner", + "publicKey":"1xkf13m9r9h502yuffsq1cg13s5648bpxrtf2c3xcq1mlj893s90.k" + } } diff --git a/NA/us/newyork/weuxel.usa.k b/NA/us/newyork/weuxel.usa.k index 054d90a..e4c9139 100644 --- a/NA/us/newyork/weuxel.usa.k +++ b/NA/us/newyork/weuxel.usa.k @@ -1,7 +1,8 @@ -"192.241.171.154:62718": { - "password":"public_access", - "publicKey":"q5nhj9kg6ddmk571jb259mct2ljd10z9xvyf05y3hu66wk4qnk20.k", - "user":"weuxel", - "contact": "hype@smash-net.org" +{ + "192.241.171.154:62718":{ + "contact":"hype@smash-net.org", + "password":"public_access", + "publicKey":"q5nhj9kg6ddmk571jb259mct2ljd10z9xvyf05y3hu66wk4qnk20.k", + "user":"weuxel" + } } - diff --git a/NA/us/northcarolina/igel-northcarolina.usa.k b/NA/us/northcarolina/igel-northcarolina.usa.k index b354599..1a04db5 100644 --- a/NA/us/northcarolina/igel-northcarolina.usa.k +++ b/NA/us/northcarolina/igel-northcarolina.usa.k @@ -1,7 +1,9 @@ -"192.198.82.242:27823":{ - "contact":"Igel@hyperboria.ca", - "gpg":"A84DFFE62B451511", - "peerName":"igel-northcarolina", - "password":"alfa-charlie-alfa-bravo", - "publicKey":"1nctdb89gtfrlnu71zyq97n14frl1r4z0ylwzc8vn7kpvrzu4yl0.k" +{ + "192.198.82.242:27823":{ + "contact":"Igel@hyperboria.ca", + "gpg":"A84DFFE62B451511", + "password":"alfa-charlie-alfa-bravo", + "peerName":"igel-northcarolina", + "publicKey":"1nctdb89gtfrlnu71zyq97n14frl1r4z0ylwzc8vn7kpvrzu4yl0.k" + } } diff --git a/NA/us/pennsylvania/nat.usa.k b/NA/us/pennsylvania/nat.usa.k index 5b9ce0e..176989e 100644 --- a/NA/us/pennsylvania/nat.usa.k +++ b/NA/us/pennsylvania/nat.usa.k @@ -1,10 +1,12 @@ -"173.62.245.186:55249": { - "peerName": "NAT", - "ipv6": "fcda:9958:9093:49f2:2677:6df6:2a5a:b01d", - "country": "us", - "website": "https://github.com/NateBrune", - "contact": "natebrune@gmail.com", - "gpg": "C95CE6BC6735BAD7", - "publicKey": "vgxqyputh4ldhxktg9msmr61pw938l0ymhkmryljsyzvmr0dtwy0.k", - "password": "Public" +{ + "173.62.245.186:55249":{ + "contact":"natebrune@gmail.com", + "country":"us", + "gpg":"C95CE6BC6735BAD7", + "ipv6":"fcda:9958:9093:49f2:2677:6df6:2a5a:b01d", + "password":"Public", + "peerName":"NAT", + "publicKey":"vgxqyputh4ldhxktg9msmr61pw938l0ymhkmryljsyzvmr0dtwy0.k", + "website":"https://github.com/NateBrune" + } } diff --git a/README.md b/README.md index fcde7fa..02273dc 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ By following this scheme, we make it possible for users to programmatically find ## 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 must contain the necessary fields: + ip/port @@ -56,17 +56,16 @@ By following this scheme, we make it possible for users to programmatically find ``` -"192.168.1.5:10326": { - "login": "default-login", - "password":"nq1uhmf06k8c5594jqmpgy26813b81s", - "publicKey":"ssxlh80x0bqjfrnbkm1801xsxyd8zd45jkwn1zhlnccqj4hdqun0.k", - "peerName":"your-name-goes-here" +{ + "192.168.1.5:10326": { + "login": "default-login", + "password":"nq1uhmf06k8c5594jqmpgy26813b81s", + "publicKey":"ssxlh80x0bqjfrnbkm1801xsxyd8zd45jkwn1zhlnccqj4hdqun0.k", + "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 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. diff --git a/tests.py b/tests.py index b501e5e..20ea2cf 100755 --- a/tests.py +++ b/tests.py @@ -18,9 +18,20 @@ def validate(path): print("Validating %s" % path) try: 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() - warning = False for host in hosts: for field in REQUIRED_FIELDS: if field not in peers[host]: @@ -29,29 +40,22 @@ def validate(path): return False for field in RECOMMENDED_FIELDS: if field not in peers[host]: - warning = True print(" %sHost %s is missing the recommended field %s%s" % (YELLOW, host, field, END)) - if warning: - print(" %sSuccess, but missing recommended fields%s" % (YELLOW, END)) - else: - print(" %sSuccess!%s" % (YELLOW, END)) - return True + if not formatting: + return False except ValueError: print(" %sInvalid JSON!%s" % (RED, END)) return False if __name__ == "__main__": success = True - if len(sys.argv) == 2: - success = validate(sys.argv[1]) - else: - for directory, subdirs, files in os.walk('.'): - if len(files) > 0: + for directory, subdirs, files in os.walk('.'): + if len(files) > 0: + if directory != '.' and not directory.startswith('./.git'): for f in files: - if f.endswith('.k'): - result = validate("%s/%s" % (directory, f)) - if not result: - success = False + result = validate("%s/%s" % (directory, f)) + if not result: + success = False if not success: sys.exit(1)