{"name":"@achingbrain/nat-port-mapper","version":"1.0.10","description":"Port mapping with UPnP and NAT-PMP","license":"Apache-2.0 OR MIT","homepage":"https://github.com/achingbrain/nat-port-mapper#readme","repository":{"type":"git","url":"git+https://github.com/achingbrain/nat-port-mapper.git"},"bugs":{"url":"https://github.com/achingbrain/nat-port-mapper/issues"},"keywords":["api","forwarding","holepunch","map","mapping","nat","nat-pmp","pmp","port","upnp"],"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js","browser":"./dist/src/browser.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"release":{"branches":["master"],"plugins":[["@semantic-release/commit-analyzer",{"preset":"conventionalcommits","releaseRules":[{"breaking":true,"release":"major"},{"revert":true,"release":"patch"},{"type":"feat","release":"minor"},{"type":"fix","release":"patch"},{"type":"docs","release":"patch"},{"type":"test","release":"patch"},{"type":"deps","release":"patch"},{"scope":"no-release","release":false}]}],["@semantic-release/release-notes-generator",{"preset":"conventionalcommits","presetConfig":{"types":[{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"type":"chore","section":"Trivial Changes"},{"type":"docs","section":"Documentation"},{"type":"deps","section":"Dependencies"},{"type":"test","section":"Tests"}]}}],"@semantic-release/changelog","@semantic-release/npm","@semantic-release/github","@semantic-release/git"]},"scripts":{"clean":"aegir clean","lint":"aegir lint","dep-check":"aegir dep-check","build":"aegir build --no-bundle","release":"aegir release","test":"aegir test","test:node":"aegir test -t node"},"dependencies":{"@achingbrain/ssdp":"^4.0.1","@libp2p/logger":"^3.0.0","default-gateway":"^6.0.2","err-code":"^3.0.1","it-first":"^3.0.1","p-defer":"^4.0.0","p-timeout":"^6.1.1","xml2js":"^0.6.0"},"devDependencies":{"@types/default-gateway":"^3.0.1","@types/xml2js":"^0.4.11","aegir":"^40.0.8"},"_id":"@achingbrain/nat-port-mapper@1.0.10","gitHead":"ad74b7f68406cf886fca9ccd4edcd41c5e79e06b","_nodeVersion":"18.17.0","_npmVersion":"9.8.1","dist":{"integrity":"sha512-GW+zu06nD3l1EFNouLoXteY1g97mC0F5aTS2Ozxql5A5/eXJG4VisVXC4JMTAffNOL/XvqSYhSF2ybZAT1AQzw==","shasum":"39d7b6fc3bf8b77df3d17ce6bfd2894e902005c8","tarball":"http://registry-npm.ywwl.com/@achingbrain/nat-port-mapper/download/@achingbrain/nat-port-mapper-1.0.10.tgz","fileCount":38,"unpackedSize":102671,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDAPkshXMaW2AwBNt7Z8wF6vy3je5T66BwzY9zOe2iL7QIhANM8ZNm+MjMf0i7dcPE6tiJNZiVmjWjZiquI9oqs2GZD"}],"size":24529,"noattachment":false,"key":"/@achingbrain/nat-port-mapper/-/@achingbrain/nat-port-mapper-1.0.10.tgz"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"achingbrain","email":"alex@achingbrain.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nat-port-mapper_1.0.10_1691090175120_0.5219837960800022"},"_hasShrinkwrap":false,"readme":"# @achingbrain/nat-port-mapper <!-- omit in toc -->\n\n[![codecov](https://img.shields.io/codecov/c/github/achingbrain/nat-port-mapper.svg?style=flat-square)](https://codecov.io/gh/achingbrain/nat-port-mapper)\n[![CI](https://img.shields.io/github/actions/workflow/status/achingbrain/nat-port-mapper/js-test-and-release.yml?branch=master\\&style=flat-square)](https://github.com/achingbrain/nat-port-mapper/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)\n\n> Port mapping with UPnP and NAT-PMP\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n- [Usage](#usage)\n- [Credits](#credits)\n- [Additional Information](#additional-information)\n- [License](#license)\n- [Contribution](#contribution)\n\n## Install\n\n```console\n$ npm i @achingbrain/nat-port-mapper\n```\n\n## Usage\n\n```js\nimport { upnpNat } from '@achingbrain/nat-port-mapper'\n\nconst client = await upnpNat({\n  // all fields are optional\n  ttl: number // how long mappings should live for in seconds - min 20 minutes, default 2 hours\n  description: string // default description to pass to the router for a mapped port\n  gateway: string // override the router address, will be auto-detected if not set\n  keepAlive: boolean // if true, refresh the mapping ten minutes before the ttl is reached, default true\n})\n\n// Map public port 1000 to private port 1000 with TCP\nawait client.map({\n  localPort: 1000,\n  protocol: 'TCP'\n})\n\n// Map public port 2000 to private port 3000 with UDP\nawait client.map({\n  publicPort: 2000,\n  localPort: 3000,\n  protocol: 'UDP'\n})\n\n// Unmap port public and private port 1000 with TCP\nawait client.unmap({\n  localPort: 1000,\n  protocol: 'TCP'\n})\n\n// Get external IP\nconst externalIp = await client.externalIp()\n\nconsole.log('External IP:', ip)\n\n// Unmap all mapped ports\nclient.close()\n```\n\n## Credits\n\nBased on [alxhotel/nat-api](https://github.com/alxhotel/nat-api)\n\n## Additional Information\n\n- <http://miniupnp.free.fr/nat-pmp.html>\n- <http://wikipedia.org/wiki/NAT_Port_Mapping_Protocol>\n- <http://tools.ietf.org/html/draft-cheshire-nat-pmp-03>\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","publish_time":1691090175358,"_cnpm_publish_time":1691090175358,"dist-tags":{"latest":"4.0.5"}}