<commit_before>#!/usr/bin/env node

var tele = require("./index.js");
var fs = require("fs");
var path = require("path");
var argv = require("optimist")
  .default("id", "./seed.json")
  .default("port", 42424)
  .boolean("v").describe("v", "verbose")
  .boolean("nolan").describe("nolan", "disable lan usage")
  .argv;

if(argv.v) tele.debug(console.log);
tele.info(function(){console.log.apply(console,arguments)});

if(argv.port == 42420)
{
  console.log("that port is reserved");
  process.exit(1);
}

// localize our id file
argv.id = path.join(__dirname, argv.id);

tele.init(argv, function(err, seed){
  if(!seed) return console.log("something went wrong :(",err) || process.exit(1);
  console.log("PATHS",seed.paths);
  var ip4 = seed.paths.pub4 || seed.paths.lan4;
  var ip6 = seed.paths.pub6 || seed.paths.lan6;
  var info = {paths:[], parts:seed.parts, keys:seed.keys};
  info.paths.push({type:"ipv4",ip:ip4.ip,port:ip4.port});
  info.paths.push({type:"ipv6",ip:ip6.ip,port:ip6.port});
  if(seed.paths.http.http) info.paths.push({type:"http",http:seed.paths.http.http});
  else info.paths.push({type:"http",http:"http://"+ip4.ip+":"+seed.paths.http.port});
  
  info.bridge = true;
  var seeds = {};
  seeds[seed.hashname] = info;
  console.log(JSON.stringify(seeds,null,2));
  console.log("connected to "+Object.keys(seed.lines).length+" mesh seed peers");
});
<commit_msg>ipv6 optional<commit_after>#!/usr/bin/env node

var tele = require("./index.js");
var fs = require("fs");
var path = require("path");
var argv = require("optimist")
  .default("id", "./seed.json")
  .default("port", 42424)
  .boolean("v").describe("v", "verbose")
  .boolean("nolan").describe("nolan", "disable lan usage")
  .argv;

if(argv.v) tele.debug(console.log);
tele.info(function(){console.log.apply(console,arguments)});

if(argv.port == 42420)
{
  console.log("that port is reserved");
  process.exit(1);
}

// localize our id file
argv.id = path.join(__dirname, argv.id);

tele.init(argv, function(err, seed){
  if(!seed) return console.log("something went wrong :(",err) || process.exit(1);
  console.log("PATHS",seed.paths);
  var ip4 = seed.paths.pub4 || seed.paths.lan4;
  var ip6 = seed.paths.pub6 || seed.paths.lan6;
  var info = {paths:[], parts:seed.parts, keys:seed.keys};
  info.paths.push({type:"ipv4",ip:ip4.ip,port:ip4.port});
  if(ip6) info.paths.push({type:"ipv6",ip:ip6.ip,port:ip6.port});
  if(seed.paths.http.http) info.paths.push({type:"http",http:seed.paths.http.http});
  else info.paths.push({type:"http",http:"http://"+ip4.ip+":"+seed.paths.http.port});
  
  info.bridge = true;
  var seeds = {};
  seeds[seed.hashname] = info;
  console.log(JSON.stringify(seeds,null,2));
  console.log("connected to "+Object.keys(seed.lines).length+" mesh seed peers");
});

{'fraction_non_alphanumeric': 0.22102231821454282, 'fraction_numerical': 0.019438444924406047, 'mean_word_length': 4.950749464668094, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3758713', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1026, 'n_words': 172}