{"_id":"nat-sampler","_rev":"1257015","name":"nat-sampler","description":"Sample addresses to figure out if a host + port is consistent","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"mafintosh","email":""}],"time":{"modified":"2021-10-14T18:41:00.000Z","created":"2021-07-21T21:38:19.562Z","1.0.1":"2021-07-21T21:45:10.916Z","1.0.0":"2021-07-21T21:38:32.782Z","0.0.0":"2021-07-21T21:38:19.562Z"},"users":{},"author":{"name":"Mathias Buus","url":"@mafintosh"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nat-sampler.git"},"versions":{"1.0.1":{"name":"nat-sampler","version":"1.0.1","description":"Sample addresses to figure out if a host + port is consistent","main":"index.js","dependencies":{},"devDependencies":{"standard":"^16.0.3","tape":"^5.2.2"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nat-sampler.git"},"scripts":{"test":"standard && tape test.js"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nat-sampler/issues"},"homepage":"https://github.com/mafintosh/nat-sampler","gitHead":"6ad6c9abdc07a8cb5dfde581df126f869e470560","_id":"nat-sampler@1.0.1","_nodeVersion":"16.1.0","_npmVersion":"6.14.13","dist":{"shasum":"2b68338ea6d4c139450cd971fd00a4ac1b33d923","size":2588,"noattachment":false,"key":"/nat-sampler/-/nat-sampler-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/nat-sampler/download/nat-sampler-1.0.1.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nat-sampler_1.0.1_1626903910246_0.34831946115264056"},"_hasShrinkwrap":false,"publish_time":1626903910916,"_cnpm_publish_time":1626903910916},"1.0.0":{"name":"nat-sampler","version":"1.0.0","description":"Sample addresses to figure out if a host + port is consistent","main":"index.js","dependencies":{},"devDependencies":{"standard":"^16.0.3","tape":"^5.2.2"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nat-sampler.git"},"scripts":{"test":"standard && tape test.js"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nat-sampler/issues"},"homepage":"https://github.com/mafintosh/nat-sampler","gitHead":"18186b534487421758e9cbcda1955081c5ccdf0e","_id":"nat-sampler@1.0.0","_nodeVersion":"16.1.0","_npmVersion":"6.14.13","dist":{"shasum":"62188b9ab98a62bb75ad144661baacddf1f80263","size":2574,"noattachment":false,"key":"/nat-sampler/-/nat-sampler-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/nat-sampler/download/nat-sampler-1.0.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nat-sampler_1.0.0_1626903512672_0.7039385186505418"},"_hasShrinkwrap":false,"publish_time":1626903512782,"_cnpm_publish_time":1626903512782},"0.0.0":{"name":"nat-sampler","version":"0.0.0","description":"Sample addresses to figure out if a host + port is consistent","main":"index.js","dependencies":{},"devDependencies":{"standard":"^16.0.3","tape":"^5.2.2"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/nat-sampler.git"},"scripts":{"test":"standard && tape test.js"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/nat-sampler/issues"},"homepage":"https://github.com/mafintosh/nat-sampler","gitHead":"76d99c9298e11322e4e4a3663089959289c25c7f","_id":"nat-sampler@0.0.0","_nodeVersion":"16.1.0","_npmVersion":"6.14.13","dist":{"shasum":"ad0a47bddb0e40b3d2fc2dc9bf0b24a0ee158e5e","size":2574,"noattachment":false,"key":"/nat-sampler/-/nat-sampler-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/nat-sampler/download/nat-sampler-0.0.0.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nat-sampler_0.0.0_1626903499373_0.9269442992066577"},"_hasShrinkwrap":false,"publish_time":1626903499562,"_cnpm_publish_time":1626903499562}},"readme":"# nat-sampler\n\nSample addresses to figure out if a host + port is consistent\n\n```\nnpm install nat-sampler\n```\n\n## Usage\n\n``` js\nconst NatSampler = require('nat-sampler')\n\nconst s = new NatSampler()\n\n// add a sample\nconst hits = s.add('127.0.0.1', 9090)\n\nconsole.log('In there this many times:', hits)\nconsole.log('Estimated host + port', s.host, s.port)\n```\n\n## API\n\n#### `s = new NatSampler()`\n\nMake a new sampler.\n\n#### `hits = s.add(host, port)`\n\nAdd a sample of your host and port.\nReturns how many hits this entry has.\n\n#### `s.host`\n\nWhat the sampler thinks your host is.\n\nIf your host is unknown it will be `null`.\n\n#### `s.port`\n\nWhat the sampler thinks your port is.\n\nIf your port is random or unknown it will be `0`.\n\n#### `s.size`\n\nHow many samples the sampler is basing this on.\n\n## Error correction\n\nThe sampler applies some simple error correction to make sure bad samples do not mess it up.\n\n* If it has `<=` 3 samples, it will disregard none outliers.\n* If it has `<=` 7 samples, it will disregard one outliers.\n* If it has `<=` 11 samples, it will disregard two outliers.\n* If it has `>` 11 samples, it will disregard three outliers.\n\nAt max it keeps 16 samples of `{ host, port }` pairs for the analysis.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/mafintosh/nat-sampler","bugs":{"url":"https://github.com/mafintosh/nat-sampler/issues"},"license":"MIT"}