{"name":"@multiformats/multiaddr","version":"10.1.0","description":"multiaddr implementation (binary + string representation of network addresses)","type":"module","types":"./dist/src/index.d.ts","eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"scripts":{"pretest":"npm run build","test":"aegir test -f ./dist/test/**/*.js","test:browser":"aegir test -t browser -f ./dist/test/**/*.js","test:node":"aegir test -t node -f ./dist/test/**/*.js","test:electron-main":"aegir test -t electron-main -f ./dist/test/**/*.js","test:electron-renderer":"aegir test -t electron-renderer -f ./dist/test/**/*.js","lint":"aegir ts -p check && aegir lint","release":"aegir release --docs","release-minor":"aegir release --target node --type minor --docs","release-major":"aegir release --type major --docs","build":"tsc","dep-check":"aegir dep-check dist/src/**/*.js dist/test/**/*.js"},"browser":{"./dist/src/resolvers/dns.js":"./dist/src/resolvers/dns.browser.js"},"repository":{"type":"git","url":"git+https://github.com/multiformats/js-multiaddr.git"},"keywords":["multiaddr","binary","string"],"license":"MIT","bugs":{"url":"https://github.com/multiformats/js-multiaddr/issues"},"homepage":"https://github.com/multiformats/js-multiaddr","dependencies":{"dns-over-http-resolver":"^2.0.1","err-code":"^3.0.1","is-ip":"^3.1.0","multiformats":"^9.4.5","uint8arrays":"^3.0.0","varint":"^6.0.0"},"devDependencies":{"@types/varint":"^6.0.0","aegir":"^36.1.1","sinon":"^12.0.1","util":"^0.12.3"},"gitHead":"62b16d81baf5d655f2fc973a804f599cc34de6f6","_id":"@multiformats/multiaddr@10.1.0","_nodeVersion":"16.13.1","_npmVersion":"7.24.2","dist":{"integrity":"sha512-RZp2JjAU4rU734OLWv0A1spZuI1bYL0tkN04M30zzVxPwV6TxsnEl8nYghaZnJrZOdDE9saBqRcjpTfFA1GvVQ==","shasum":"d0b151d96e505274dfd50bd6e8e2c5849be060be","tarball":"http://registry-npm.ywwl.com/@multiformats/multiaddr/download/@multiformats/multiaddr-10.1.0.tgz","fileCount":43,"unpackedSize":127650,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh1DsXCRA9TVsSAnZWagAAVpEP/iXs44/c8mmXTUi2U+ln\n3kTCIps8G0YFUt6oQTrlo1RfTYkTrXIOwn87l1xE6a5NuL/OwK0cr6lNi9rm\n3fkKlK0ZIvoqXM8mt+TlZJQnSKWqxuNOtH+OabvUU7PYLAFYZz3c4OZJheBe\n6kVwD7JaUZZmVK+wgTMZmLhhIyhUK5189seJj5iYPDEZUHoiNBjCEm9rnfJ3\nAhixYRRD8rZYLiDdO5/1VgN68VARM2Rtp2jqm6yyIOTYLyxgBkph7YP2FoIR\n7Zmd8yspdTXRseVNYZYhvkc4oXxDSs8VnO9ASoMK1HXNEH5ZvEECgq8/aFpp\nqHZ+MukN2rh/qRl7pmAyrr/SJSNaovgmxj4qjmZZ60qZowktZfit/ijewNfU\nTJRUYHZEKeQ3f5dsGH/BJgQTOCp1vBx64mZxc2bp6ZEa9Vj93D37C9oE4gWs\nCj0kfA4zRQgWFjTAL3WWIC/JXss9LjIZN6aJN8hvihaiRQXqvYUYDkc/3bBF\nxmbBNYwU8htO6Fdmx4DTmccXXG3q8yP7P/CC5UFyl5syApYs07bhedcpYXd2\nUE/aAbHoIMI/lxfJVUteO7+qZXCRh5S7H97L0rD1THauIb1TEdO+OAViNva0\n3Z6saghziHyDZilvyEIZivMgtQpm3GfYtbHVg7N3JE9lDZ9zl48S1z1K+PnV\n4R7a\r\n=Vq98\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCyv9BXcBF0JsGhdptwF4BwGKfkNZGNzreInxCkv3+H0AIhAJOXj/p7qO62t7tRSHBeHB43tJvK3mBQ9uWmQkLFg4LL"}],"size":28677,"noattachment":false,"key":"/@multiformats/multiaddr/-/@multiformats/multiaddr-10.1.0.tgz"},"_npmUser":{"name":"achingbrain","email":"alex@achingbrain.net"},"directories":{},"maintainers":[{"name":"vascosantos","email":"santos.vasco10@gmail.com"},{"name":"achingbrain","email":"alex@achingbrain.net"},{"name":"lidel","email":"lidel@lidel.org"},{"name":"rvagg","email":"r@va.gg"},{"name":"daviddias","email":"mail@daviddias.me"},{"name":"vmx","email":"volker.mische@gmail.com"},{"name":"mikeal","email":"mikeal.rogers@gmail.com"},{"name":"hugomrdias","email":"hugomrdias@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/multiaddr_10.1.0_1641298711155_0.93195835207872"},"_hasShrinkwrap":false,"readme":"# @multiformats/multiaddr\n\n[![multiformats.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://multiformats.io)\n[![codecov](https://img.shields.io/codecov/c/github/multiformats/js-multiaddr.svg?style=flat-square)](https://codecov.io/gh/multiformats/js-multiaddr)\n[![CI](https://img.shields.io/github/actions/workflow/status/multiformats/js-multiaddr/js-test-and-release.yml?branch=main\\&style=flat-square)](https://github.com/multiformats/js-multiaddr/actions/workflows/js-test-and-release.yml?query=branch%3Amain)\n\n> multiaddr implementation (binary + string representation of network addresses)\n\n# About\n\n<!--\n\n!IMPORTANT!\n\nEverything in this README between \"# About\" and \"# Install\" is automatically\ngenerated and will be overwritten the next time the doc generator is run.\n\nTo make changes to this section, please update the @packageDocumentation section\nof src/index.js or src/index.ts\n\nTo experiment with formatting, please run \"npm run docs\" from the root of this\nrepo and examine the changes made.\n\n-->\n\nA standard way to represent addresses that\n\n- support any standard network protocol\n- are self-describing\n- have a binary packed format\n- have a nice string representation\n- encapsulate well\n\n## Example\n\n```TypeScript\nimport { multiaddr } from '@multiformats/multiaddr'\nconst addr =  multiaddr(\"/ip4/127.0.0.1/udp/1234\")\n// Multiaddr(/ip4/127.0.0.1/udp/1234)\n\nconst addr = multiaddr(\"/ip4/127.0.0.1/udp/1234\")\n// Multiaddr(/ip4/127.0.0.1/udp/1234)\n\naddr.bytes\n// <Uint8Array 04 7f 00 00 01 11 04 d2>\n\naddr.toString()\n// '/ip4/127.0.0.1/udp/1234'\n\naddr.protos()\n// [\n//   {code: 4, name: 'ip4', size: 32},\n//   {code: 273, name: 'udp', size: 16}\n// ]\n\n// gives you an object that is friendly with what Node.js core modules expect for addresses\naddr.nodeAddress()\n// {\n//   family: 4,\n//   port: 1234,\n//   address: \"127.0.0.1\"\n// }\n\naddr.encapsulate('/sctp/5678')\n// Multiaddr(/ip4/127.0.0.1/udp/1234/sctp/5678)\n```\n\n## Resolving DNSADDR addresses\n\n[DNSADDR](https://github.com/multiformats/multiaddr/blob/master/protocols/DNSADDR.md) is a spec that allows storing a TXT DNS record that contains a Multiaddr.\n\nTo resolve DNSADDR addresses, call the `.resolve()` function the multiaddr, optionally passing a `DNS` resolver.\n\nDNSADDR addresses can resolve to multiple multiaddrs, since there is no limit to the number of TXT records that can be stored.\n\n## Example - Resolving DNSADDR Multiaddrs\n\n```TypeScript\nimport { multiaddr, resolvers } from '@multiformats/multiaddr'\nimport { dnsaddr } from '@multiformats/multiaddr/resolvers'\n\nresolvers.set('dnsaddr', dnsaddr)\n\nconst ma = multiaddr('/dnsaddr/bootstrap.libp2p.io')\n\n// resolve with a 5s timeout\nconst resolved = await ma.resolve({\n  signal: AbortSignal.timeout(5000)\n})\n\nconsole.info(await ma.resolve(resolved)\n// [Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...')...]\n```\n\n## Example - Using a custom DNS resolver to resolve DNSADDR Multiaddrs\n\nSee the docs for [@multiformats/dns](https://www.npmjs.com/package/@multiformats/dns) for a full breakdown of how to specify multiple resolvers or resolvers that can be used for specific TLDs.\n\n```TypeScript\nimport { multiaddr } from '@multiformats/multiaddr'\nimport { dns } from '@multiformats/dns'\nimport { dnsJsonOverHttps } from '@multiformats/dns/resolvers'\n\nconst resolver = dns({\n  '.': dnsJsonOverHttps('https://cloudflare-dns.com/dns-query')\n})\n\nconst ma = multiaddr('/dnsaddr/bootstrap.libp2p.io')\nconst resolved = await ma.resolve({\n dns: resolver\n})\n\nconsole.info(resolved)\n// [Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...'), Multiaddr('/ip4/147.75...')...]\n```\n\n# Install\n\n```console\n$ npm i @multiformats/multiaddr\n```\n\n## Browser `<script>` tag\n\nLoading this module through a script tag will make it's exports available as `MultiformatsMultiaddr` in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/@multiformats/multiaddr/dist/index.min.js\"></script>\n```\n\n# API Docs\n\n- <https://multiformats.github.io/js-multiaddr>\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":1641298711430,"_cnpm_publish_time":1641298711430,"dist-tags":{"latest":"13.0.3"}}