{"name":"public-ip","version":"6.0.1","description":"Get your public IP address — very fast!","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/public-ip.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","node":"./index.js","default":"./browser.js"},"engines":{"node":">=14.16"},"scripts":{"test":"xo && ava && tsd"},"keywords":["get","ip","ipv4","ipv6","address","external","public","machine","fast","opendns","dns"],"dependencies":{"aggregate-error":"^4.0.1","dns-socket":"^4.2.2","got":"^12.1.0","is-ip":"^4.0.0"},"devDependencies":{"ava":"^4.3.0","sinon":"^14.0.0","time-span":"^5.0.0","tsd":"^0.21.0","xo":"^0.50.0"},"xo":{"envs":["node","browser"]},"ava":{"serial":true,"files":["test.js"]},"types":"./index.d.ts","gitHead":"f3421718a1853a6a1dda3926d599f3ff371618fe","bugs":{"url":"https://github.com/sindresorhus/public-ip/issues"},"homepage":"https://github.com/sindresorhus/public-ip#readme","_id":"public-ip@6.0.1","_nodeVersion":"14.19.2","_npmVersion":"8.3.2","dist":{"integrity":"sha512-1/Mxa1MKrAQ4jF5IalECSBtB0W1FAtnG+9c5X16jjvV/Gx9fiRy7xXIrHlBGYjnTlai0zdZkM3LrpmASavmAEg==","shasum":"0161e18d4be922cf78da851581c0faab4319339a","tarball":"http://registry-npm.ywwl.com/public-ip/download/public-ip-6.0.1.tgz","fileCount":7,"unpackedSize":16285,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDwxVK14P1cdDIgRP2jlAp8u+IOrQcWpuT3GFpIHQILqgIhANgqzyrI7yWiAhoF04T1um5ZBDK/sel6odu+IagaIylB"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJitb0IACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrozA//UlqXvDVdRkwrILWUVSKzJyWIgbJICo2ib9rOQU9s9cpy6khr\r\n2UulnjyQ/ry/5LURThof8eddGCRYrP73/C4UAzMg+8oiPZjq+pWIZuTSE+ga\r\n4fQARfNJJ3UyHD6enVJWhYha5YAsQ3N20s/lPqZ0BeE7kcYc+iOga+0Rx/9p\r\nG8vavRN3d+RWH80+ViJXUxhXbFldq0TozG0mBNpOKRTD1C4ecGeXzfpKnYwO\r\nBc9v6F4w9dv539WazhtUmWfTm8Jtp9drfF0hp0ypUvMx42EpslRtxTL6o7XU\r\nhniyTkFGQMZACT57eSSGt6XFNw9etxI8mZeiXxonwuk51aTHYrNNqWwKQ9Q5\r\ngxdc+rZVqOP5ooArSqp5UPOHqA5kH4MdEs6g6VK7ajkfAZVrx8lTyYhjHDE0\r\nF8xs1GlfJn5g8NUt/iG+ukHHAMMpYzz2L1JYHkdvxAiQSHL/DOKYSQe7Qm8M\r\nQIYi9iA8ZlNW/tmVQHmJ56MM9at1SPXMjJHnKTrLg81vwxDIF8EhzvmOrBvy\r\nwPNQ6dqR6kx0jwFaWI9nV6z4Rgtz3rbTXJFxsrwlAUXzm9whXHldL2SzC1uV\r\ncuv4gTjfRjzgUyhPNGuC+2qzs7N/xWql9R36ShBtyodsjC6IouZF/jXX2DsR\r\nKvwHEm0NE7WDCN/3SRt44RC0CWk/K+ht/jg=\r\n=/25P\r\n-----END PGP SIGNATURE-----\r\n","size":4846,"noattachment":false,"key":"/public-ip/-/public-ip-6.0.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"},{"name":"silverwind","email":"npm@silverwind.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/public-ip_6.0.1_1656077576655_0.302859718225869"},"_hasShrinkwrap":false,"readme":"# public-ip\n\n> Get your public IP address - very fast!\n\nIn Node.js, it queries the DNS records of OpenDNS, Google DNS, and HTTPS services to determine your IP address. In browsers, it uses the excellent [icanhaz](https://github.com/major/icanhaz) and [ipify](https://ipify.org) services through HTTPS.\n\n## Install\n\n```sh\nnpm install public-ip\n```\n\n## Usage\n\n```js\nimport {publicIp, publicIpv4, publicIpv6} from 'public-ip';\n\nconsole.log(await publicIp()); // Falls back to IPv4\n//=> 'fe80::200:f8ff:fe21:67cf'\n\nconsole.log(await publicIpv6());\n//=> 'fe80::200:f8ff:fe21:67cf'\n\nconsole.log(await publicIpv4());\n//=> '46.5.21.123'\n```\n\n## API\n\n### publicIp(options?)\n\nReturns a `Promise<string>` with your public IPv4 or IPv6 address. Rejects on error or timeout.\n\nA `.cancel()` method is available on the promise, which can be used to cancel the request.\n\n### publicIpv6(options?)\n\nReturns a `Promise<string>` with your public IPv6 address. Rejects on error or timeout.\n\nA `.cancel()` method is available on the promise, which can be used to cancel the request.\n\n### publicIpv4(options?)\n\nReturns a `Promise<string>` with your public IPv4 address. Rejects on error or timeout.\n\nA `.cancel()` method is available on the promise, which can be used to cancel the request.\n\n#### options\n\nType: `object`\n\n##### onlyHttps\n\nType: `boolean`\\\nDefault: `false`\n\nUse a HTTPS check using the [icanhazip.com](https://github.com/major/icanhaz) service instead of the DNS query. [ipify.org](https://www.ipify.org) is used as a fallback if `icanhazip.com` fails. This check is much more secure and tamper-proof, but also a lot slower. **This option is only available in the Node.js version**. The default behaviour is to check against DNS before using HTTPS fallback. If set to `true`, it will *only* check against HTTPS.\n\n##### fallbackUrls\n\nType: `string[]`\\\nDefault: `[]`\n\nAdd your own custom HTTPS endpoints to get the public IP from. They will only be used if everything else fails. Any service used as fallback *must* return the IP as a plain string.\n\n```js\nimport {publicIpv6} from 'public-ip';\n\nawait publicIpv6({\n\tfallbackUrls: [\n\t\t'https://ifconfig.co/ip'\n\t]\n});\n```\n\n##### timeout\n\nType: `number`\\\nDefault: `5000`\n\nThe time in milliseconds until a request is considered timed out.\n\n### IpNotFoundError\n\nError thrown when the public IP address could not be found.\n\n### CancelError\n\nError thrown when the operation was canceled.\n\n## Maintainers\n\n- [Sindre Sorhus](https://github.com/sindresorhus)\n- [silverwind](https://github.com/silverwind)\n\n## Related\n\n- [public-ip-cli](https://github.com/sindresorhus/public-ip-cli) - CLI for this module\n- [internal-ip](https://github.com/sindresorhus/internal-ip) - Get your internal IP address\n","publish_time":1656077576879,"_cnpm_publish_time":1656077576879,"dist-tags":{"latest":"8.0.0"}}