123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #!/usr/bin/env node
- /* -*- Mode:Js */
- /* vim: set expandtab ts=4 sw=4: */
- /*
- * You may redistribute this program and/or modify it under the terms of
- * the GNU General Public License as published by the Free Software Foundation,
- * either version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
- var Cjdns = require('../contrib/nodejs/cjdnsadmin/cjdnsadmin');
- var nThen = require('../contrib/nodejs/cjdnsadmin/nthen');
- var dump = function (millName) {
- var cjdns;
- nThen(function (waitFor) {
- Cjdns.connectWithAdminInfo(waitFor(function (x) { cjdns = x; }));
- }).nThen(function (waitFor) {
- var list = [];
- var again = function (i) {
- cjdns.Janitor_dumpRumorMill(i, millName, function (err, out) {
- if (err) { throw err; }
- list.push.apply(list, out.addresses);
- if (out.addresses.length) {
- again(i+1);
- } else {
- list.sort();
- list.forEach(function (addr) { console.log(addr); });
- console.log("total " + out.total);
- cjdns.disconnect();
- }
- });
- };
- again(0);
- });
- };
- var main = function (args) {
- if (['externalMill','linkMill','nodeMill','dhtMill'].indexOf(args[args.length-1]) !== -1) {
- dump(args[args.length-1]);
- return;
- }
- console.log("Usage:");
- console.log(" dumpRumorMill externalMill # dump externally accessable mill");
- console.log(" dumpRumorMill linkMill # dump high-priority mill for improving routes");
- console.log(" dumpRumorMill nodeMill # dump new node discovery mill");
- console.log(" dumpRumorMill dhtMill # dump DHT maintanence mill");
- };
- main(process.argv);
|