{"name":"@achingbrain/nat-port-mapper","version":"1.0.0","description":"Port mapping with UPnP and NAT-PMP","license":"Apache-2.0 OR MIT","homepage":"https://github.com/achingbrain/upnp-nat#readme","repository":{"type":"git","url":"git+https://github.com/achingbrain/upnp-nat.git"},"bugs":{"url":"https://github.com/achingbrain/upnp-nat/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":{".":{"import":"./dist/src/index.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":"chore","release":"patch"},{"type":"docs","release":"patch"},{"type":"test","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":"Trivial Changes"},{"type":"test","section":"Tests"}]}}],"@semantic-release/changelog","@semantic-release/npm","@semantic-release/github","@semantic-release/git"]},"scripts":{"lint":"aegir lint","dep-check":"aegir dep-check dist/src/**/*.js dist/test/**/*.js","build":"tsc","pretest":"npm run build","test":"aegir test -f ./dist/test/*.js -f ./dist/test/**/*.js","test:node":"npm run test -- -t node --cov","test:electron-main":"npm run test -- -t electron-main","release":"semantic-release"},"dependencies":{"@achingbrain/ssdp":"^3.0.1","@libp2p/logger":"^1.0.4","default-gateway":"^6.0.2","err-code":"^3.0.1","it-first":"^1.0.7","p-defer":"^4.0.0","p-timeout":"^5.0.2","undici":"^4.14.1","xml2js":"^0.4.23"},"devDependencies":{"@types/default-gateway":"^3.0.1","@types/xml2js":"^0.4.9","aegir":"^36.1.3"},"gitHead":"de8511933ab8478642d06b871e19d72aa50bb858","_id":"@achingbrain/nat-port-mapper@1.0.0","_nodeVersion":"16.14.0","_npmVersion":"7.24.2","dist":{"integrity":"sha512-BNa5CU5BHVk8r7tPDEipJ5rvkQsvh1HIC6kso+gdMD61uKpKXVocmWKtb4UAi/N1kfHmZ+cTCtAjmdIvNMeBBg==","shasum":"a68844aca8fe52d74fc1e9719440e8f675ba2b36","tarball":"http://registry-npm.ywwl.com/@achingbrain/nat-port-mapper/download/@achingbrain/nat-port-mapper-1.0.0.tgz","fileCount":33,"unpackedSize":92851,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiGz4qACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo98A//ThmoeMsBgsJyefJXDFlq4aWxqMf39cYbFdV64SeBVPJiKCYj\r\nNWfTskxOxEayi5cZBTqsVYoudRR28Uh7awhninel/coKk8tLe1eIu1AdNX3u\r\n83Yvk0+h+PF3uD66FJE8XUCq0J1jYiGLc76QNtyUy7r7SmyvcY5WVXNRIiah\r\nmKd7MI9YeJwuaMGCEzCIFesRn0tuOpbluWlhypgS8OUBh/nd8foVxQyW2sSj\r\nbiBcbxgMaVFFSpLxNoBk69jIOg/UaKV7l0mpP3cXarhinVOhAfOy+rlqlYjw\r\n/PxjJD8Y/4sD7Wt2vJ5GVD/p+K5keekpU9m2tsz1sbqUPk6WdaSApMW4U+Iw\r\nKI7ponVaGwAla3synfhrDE34053Ze4PmyWLqJB5ZCN/yL6TIntj6ZcITsDX7\r\nPWzBBXQLFbCY79YwWvu3n1RlY0tDk0CHqMIv/wNBsorNkBXde+DN/uCehf62\r\nej4JWYvwZNnQERxmHhvIIyz7ALGXRToZ0zwwKJi+7Djzqpz8Kx3m3JQ/ootB\r\nJo+4tVsNPqxt7NaFeXtOXIzq7JnC0PKRfYLVZ093I+ETIJkMFdcWooFcb+6E\r\nyZotcJgNFPsnHUOYLJWIil/oq2SS+7gKVJbD5kGVJHU5jl9iSPbqGeR0ghhX\r\nb7avydXR/ZW0qsmHohgXz5umMkQBjccV++w=\r\n=wdK7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDR7o3njbHJQLIEZPSSktrDjawdFuQFKzBdaBlRs7wnpAIhAKNgizaNGkOH0b5CpJfd9cXRXqOPw1I6doFrm+0rmX9n"}],"size":22575,"noattachment":false,"key":"/@achingbrain/nat-port-mapper/-/@achingbrain/nat-port-mapper-1.0.0.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.0_1645952554229_0.46921245114311794"},"_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":1645952554372,"_cnpm_publish_time":1645952554372,"dist-tags":{"latest":"4.0.5"}}