<commit_before>var os = require('os')
var ip = require('ip')
//pick the first reasonable looking host.
//this should *just work* when running on a vps.

var isPrivate = ip.isPrivate

function isNonPrivate (e) {
  return !isPrivate(e)
}


module.exports = function (inter, filter) {
  inter = inter || os.networkInterfaces()
  filter = filter || isNonPrivate
  for(var k in inter) {
    for(var i in inter[k]) {
      var e = inter[k][i]
      // find a reasonable looking address
      if(!e.internal && filter(e.address))
          return e.address
    }
  }
}

module.exports.private = function (inter) {
  return module.exports(inter, isPrivate)
}

if(!module.parent) {
  var h = module.exports()
  if(!h) {
    console.error('no non-private address')
    console.error('private:', module.exports.private())
    process.exit(1)
  }
  console.log(h)
}<commit_msg>request a v4 or v6 address specifically<commit_after>var os = require('os')
var ip = require('ip')
//pick the first reasonable looking host.
//this should *just work* when running on a vps.

var isPrivate = ip.isPrivate

function isNonPrivate (e) {
  return !isPrivate(e)
}


module.exports = function (inter, filter) {
  inter = inter || os.networkInterfaces()
  filter = filter || isNonPrivate
  for(var k in inter) {
    for(var i in inter[k]) {
      var e = inter[k][i]
      // find a reasonable looking address
      if(!e.internal && filter(e.address, e))
          return e.address
      else
        console.error(e)
    }
  }
}

module.exports.private = function (inter) {
  return module.exports(inter, isPrivate)
}

module.exports.v4 = module.exports(null, function (addr, e) {
  return e.family === 'IPv4' && isNonPrivate(addr)
})

module.exports.v6 = module.exports(null, function (addr, e) {
  return e.family === 'IPv6' && isNonPrivate(addr)
})


if(!module.parent) {
  var h = module.exports()
  if(!h) {
    console.error('no non-private address')
    console.error('private:', module.exports.private())
    process.exit(1)
  }
  console.log(h)
}
{'fraction_non_alphanumeric': 0.1438423645320197, 'fraction_numerical': 0.003940886699507389, 'mean_word_length': 3.2848101265822787, 'pattern_counts': {'":': 0, '<': 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': '386674', 'n_tokens_mistral': 673, 'n_tokens_neox': 668, 'n_words': 181}