cjdns/cjdns.tools.patch

30 lines
1.2 KiB
Diff
Raw Permalink Normal View History

2016-04-06 02:15:03 +00:00
diff -up ./tools/traceroute.tools ./tools/traceroute
2019-05-08 16:27:11 +00:00
--- ./tools/traceroute.tools 2019-05-02 04:02:32.000000000 -0400
+++ ./tools/traceroute 2019-05-08 12:18:10.958661859 -0400
2016-04-06 02:15:03 +00:00
@@ -83,6 +83,11 @@ var main = function (target) {
cjdns.RouterModule_getPeers("0000.0000.0000.0001", waitFor(function (err, ret) {
if (err) { throw err; }
+ if (!ret.peers) {
+ console.error('missing CJDNS admin password');
+ cjdns.disconnect();
+ process.exit(0);
+ }
self = ret.peers[0];
}));
2019-05-08 16:27:11 +00:00
@@ -101,11 +106,12 @@ var main = function (target) {
2016-04-06 02:15:03 +00:00
}).nThen(function (waitFor) {
- if (!lastRet || lastRet.nodes[0] !== lastRet.from) { return; }
+ if (!lastRet || !lastRet.nodes || lastRet.nodes[0] !== lastRet.from) { return; }
console.log('success, trying reverse trace');
process.stdout.write(lastRet.from);
tracePath(nodeToIP6(self), lastRet.from, cjdns, function (ret) {
lastRet = ret;
+ if (!ret || !ret.nodes) { return; }
2019-05-08 16:27:11 +00:00
process.stdout.write(' ' + ret.ms + 'ms\n');
2018-02-21 18:58:17 +00:00
if (ret.result === 'timeout') {
process.stdout.write('\n' + ret.from + ' ' + ret.result + '!');