{"name":"peer-info","version":"0.17.4","description":"IPFS Peer abstraction JavaScript implementation","leadMaintainer":"Vasco Santos <vasco.santos@moxy.studio>","main":"src/index.js","types":"src/index.d.ts","scripts":{"lint":"aegir lint","build":"aegir build","test":"aegir test","test:node":"aegir test -t node","test:browser":"aegir test -t browser","test:types":"npx tsc","release":"aegir release","release-minor":"aegir release --type minor","release-major":"aegir release --type major","coverage":"aegir coverage","coverage-publish":"aegir coverage --provider coveralls","size":"bundlesize -f dist/index.min.js -s 146kB"},"repository":{"type":"git","url":"git+https://github.com/libp2p/js-peer-info.git"},"keywords":["IPFS"],"engines":{"node":">=10.0.0","npm":">=6.0.0"},"license":"MIT","bugs":{"url":"https://github.com/libp2p/js-peer-info/issues"},"homepage":"https://github.com/libp2p/js-peer-info","devDependencies":{"@types/chai":"^4.2.8","@types/dirty-chai":"^2.0.2","@types/mocha":"^7.0.1","aegir":"^20.0.0","buffer-loader":"0.1.0","bundlesize":"~0.18.0","chai":"^4.2.0","dirty-chai":"^2.0.1"},"dependencies":{"mafmt":"^7.1.0","multiaddr":"^7.3.0","peer-id":"~0.13.2","unique-by":"^1.0.0"},"contributors":[{"name":"Alan Shaw","email":"alan.shaw@protocol.ai"},{"name":"Alex Potsides","email":"alex@achingbrain.net"},{"name":"Arnaud","email":"arnaud.valensi@gmail.com"},{"name":"Cayman","email":"caymannava@gmail.com"},{"name":"David Dias","email":"daviddias.p@gmail.com"},{"name":"David Dias","email":"mail@daviddias.me"},{"name":"Friedel Ziegelmayer","email":"dignifiedquire@gmail.com"},{"name":"Greenkeeper","email":"support@greenkeeper.io"},{"name":"Henrique Dias","email":"hacdias@gmail.com"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Mikerah","email":"mikerahqc@protonmail.com"},{"name":"Orie Steele","email":"orie@ohs.io"},{"name":"Pedro Teixeira","email":"i@pgte.me"},{"name":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Robert Kiel","email":"robert.kiel@validitylabs.org"},{"name":"Sid Harder","email":"sideharder@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Vasco Santos","email":"vasco.santos@ua.pt"},{"name":"Zane Starr","email":"zcstarr@gmail.com"},{"name":"haad","email":"haad@headbanggames.com"},{"name":"npmcdn-to-unpkg-bot","email":"npmcdn-to-unpkg-bot@users.noreply.github.com"},{"name":"Łukasz Kurowski","email":"crackcomm@users.noreply.github.com"},{"name":"ᴠɪᴄᴛᴏʀ ʙᴊᴇʟᴋʜᴏʟᴍ","email":"victorbjelkholm@gmail.com"}],"gitHead":"45165a6c4acbb1fb915f07a7fa7a81dd357e2858","_id":"peer-info@0.17.4","_nodeVersion":"12.14.0","_npmVersion":"6.13.4","dist":{"integrity":"sha512-uI2JcxxmEswkX7wAjB4kEP+E100Mix16kNmVcu0dhal5CEptuFN4WxuilTHE8X/9DNpn5MvYFI9gkZ/SFSFPuQ==","shasum":"576be06a6ab82ec0629c782dec1508dd7a9491e9","tarball":"http://registry-npm.ywwl.com/peer-info/download/peer-info-0.17.4.tgz","fileCount":13,"unpackedSize":6139520,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeSqRiCRA9TVsSAnZWagAAb5EP/Rmx4BVuWDcYiLplaeCN\nYSfwqDC4pFo52b+ZG5ubw/fvR5Fn1eAKeQalNmix/edYWTM1XJH1sOeLFxLS\n5dLb6V9IQHu0qimSRRyRu9TQCz/195Lu6T8+p/M4jyFvttS5mqp/j98jrpqA\ndccw47a2pdEtJdml1lOKhuMY8hCZNUqCXYDp6AJz5XNmvNO7UDEjrf/lGTcn\nIGgpnSUmvZQRa49tV59TuTBh3ilXS3pAWHyhtSdx7CWzSZqpqCee8jg0RRrg\njK3NstOBP9Tvh6HG+KIHqUAxuEZ97wZBB1tXhAtRjmiLCEH5z8FG03qaIlZ6\nBfgw88wlcsR7Kqk9FpX0eLVJbD7seL+SA0PJEYJUWIng4qHEEVLzED6NVhSP\nI4xXe/WsCIRLQ20JKq5X5aDn8rd80VbkBk5WiQvALjxZfI15IgKO2KdONuyU\nZN3eiMY5yVxI3vtIima+ztAetcH2REt0zkly+m3ZeSYjA60675TaaLw4nmi6\nwTP28C4DUbkgCuYDTSvml4elREZaVpYcNTUzn0dhQe3kbPRtAsWIWktlqF1v\ntsiZjR6B6mox7WOsIhghmxlt2BHA1qcIpExs2TG/+2CWjuD3fhGr5jWua1zc\nGmS+ETESdZNW3uk7FE1ts3fAdrBx9CqwDg9Q21ijuGMrC1piv/oe1RU92Tf5\nDHfP\r\n=fBG0\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDU5HdDBw0DQvUIHk2bvqK3AK4sTmWnZJS10xrz3c+vFAiBMQGYYtRcLMQWBdUrB3FY5BH+Zr9dEejPZl/RAxlxKkw=="}],"size":1473159,"noattachment":false,"key":"/peer-info/-/peer-info-0.17.4.tgz"},"maintainers":[{"email":"mail@daviddias.me","name":"daviddias"},{"email":"i@pgte.me","name":"pgte"}],"_npmUser":{"name":"vascosantos","email":"vasco.santos@moxy.studio"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/peer-info_0.17.4_1581950050179_0.6520514615855357"},"_hasShrinkwrap":false,"deprecated":"No longer supported for js-libp2p0.28.0 or later","readme":"# js-peer-info\n\n[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://protocol.ai)\n[![](https://img.shields.io/badge/project-libp2p-yellow.svg?style=flat-square)](http://libp2p.io/)\n[![](https://img.shields.io/badge/freenode-%23libp2p-yellow.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23libp2p)\n[![Discourse posts](https://img.shields.io/discourse/https/discuss.libp2p.io/posts.svg)](https://discuss.libp2p.io)\n[![](https://img.shields.io/codecov/c/github/libp2p/js-peer-info.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-peer-info)\n[![](https://img.shields.io/travis/libp2p/js-peer-info.svg?style=flat-square)](https://travis-ci.com/libp2p/js-peer-info)\n[![Dependency Status](https://david-dm.org/libp2p/js-peer-info.svg?style=flat-square)](https://david-dm.org/libp2p/js-peer-info)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)\n![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)\n![](https://img.shields.io/badge/Node.js-%3E%3D6.0.0-orange.svg?style=flat-square)\n\n## Lead Maintainer\n\n[Vasco Santos](https://github.com/vasco-santos)\n\n## Table of Contents\n\n- [js-peer-info](#js-peer-info)\n  - [Lead Maintainer](#lead-maintainer)\n  - [Table of Contents](#table-of-contents)\n  - [Installation](#installation)\n    - [npm](#npm)\n    - [Node.JS, Browserify, Webpack](#nodejs-browserify-webpack)\n    - [Browser: `<script>` Tag](#browser-script-tag)\n  - [Usage](#usage)\n  - [API](#api)\n    - [`PeerInfo.create([id])`](#peerinfocreateid)\n    - [`new PeerInfo(id)`](#new-peerinfoid)\n    - [`.id`](#id)\n    - [`protocols`](#protocols)\n    - [`.protocols.add(protocol)`](#protocolsaddprotocol)\n    - [`.protocols.delete(protocol)`](#protocolsdeleteprotocol)\n    - [`.multiaddrs`](#multiaddrs)\n    - [`.multiaddrs.add(addr)`](#multiaddrsaddaddr)\n    - [`.multiaddrs.addSafe(addr)`](#multiaddrsaddsafeaddr)\n    - [`.multiaddrs.delete(addr)`](#multiaddrsdeleteaddr)\n    - [`.multiaddrs.replace(existing, fresh)`](#multiaddrsreplaceexisting-fresh)\n    - [`.connect(ma)`](#connectma)\n    - [`.disconnect()`](#disconnect)\n    - [`.isConnected()`](#isconnected)\n  - [Contribute](#contribute)\n  - [License](#license)\n\n## Installation\n\n### npm\n\n```sh\n> npm i peer-info\n```\n\n### Node.JS, Browserify, Webpack\n\n```js\nconst PeerInfo = require('peer-info')\n```\n\n### Browser: `<script>` Tag\n\nLoading this module through a script tag will make the `PeerInfo` obj available in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/peer-info/dist/index.min.js\"></script>\n<!-- OR -->\n<script src=\"https://unpkg.com/peer-info/dist/index.js\"></script>\n```\n\n## Usage\n\n```js\nconst PeerInfo = require('peer-info')\nconst peer = new PeerInfo()\n\n// TCP port 5001\npeer.multiaddrs.add('/ip4/1.2.3.4/tcp/5001')\n\n// UDP port 8001\npeer.multiaddrs.add('/ip4/1.2.3.4/udp/8001')\n\n// mic/speaker soundwaves using frequencies 697 and 1209\npeer.multiaddrs.add('/sonic/bfsk/697/1209')\n```\n\n## API\n\n```js\nconst PeerInfo = require('peer-info')\n```\n\n### `PeerInfo.create([id])`\n\n- `id` optional - can be a PeerId or a JSON object(will be parsed with https://github.com/libp2p/js-peer-id#createfromjsonobj)\n\nCreates a new PeerInfo instance and if no `id` is passed it\ngenerates a new underlying [PeerID](https://github.com/libp2p/js-peer-id)\nfor it.\n\nReturns `Promise<PeerInfo>`.\n\n### `new PeerInfo(id)`\n\n- `id: PeerId` - instance of PeerId (optional)\n\nCreates a new PeerInfo instance from an existing PeerId.\n\n### `.id`\n\nThe [PeerId](https://github.com/libp2p/js-peer-id) of the peer this info relates to.\n\n### `protocols`\n\nA list of protocols that `peer` supports.\n\n### `.protocols.add(protocol)`\n\nAdds a protocol that `peer` can support. `protocol` is a string.\n\n### `.protocols.delete(protocol)`\n\nRemoves a protocol that `peer` no longer supports. `protocol` is a string.\n\n### `.multiaddrs`\n\nA list of multiaddresses instances that `peer` can be reached at.\n\n### `.multiaddrs.add(addr)`\n\n- `addr: Multiaddr`\n\nAdds a new multiaddress that `peer` can be reached at. `addr` is an instance of\na [multiaddr](https://github.com/multiformats/js-multiaddr).\n\n### `.multiaddrs.addSafe(addr)`\n\n- `addr: Multiaddr`\n\nThe `addSafe` call, in comparison to `add`, will only add the multiaddr to\n`multiaddrs` if the same multiaddr tries to be added twice.\n\nThis is a simple mechanism to prevent `multiaddrs` from becoming bloated with\nunusable addresses, which happens when we exchange observed multiaddrs with\npeers which will not provide a useful multiaddr to be shared to the rest of the\nnetwork (e.g. a multiaddr referring to a peer inside a LAN being shared to the\noutside world).\n\n### `.multiaddrs.delete(addr)`\n\n- `addr: Multiaddr`\n\nRemoves a multiaddress instance `addr` from `peer`.\n\n### `.multiaddrs.replace(existing, fresh)`\n\n- `existing: Multiaddr`\n- `fresh: Multiaddr`\n\nRemoves the array of multiaddresses `existing` from `peer`, and adds the array\nof multiaddresses `fresh`.\n\n### `.connect(ma)`\n\nRecords the given multiaddr, `ma` as the active multiaddr of the peer.\n\n- `ma: Multiaddr`\n\n### `.disconnect()`\n\nRemoves the existing connected Multiaddr from tracking.\n\n### `.isConnected()`\n\nReturns `true`  if a connected Multiaddr exists, otherwise returns `false`.\n\n## Contribute\n\nPRs accepted.\n\nSmall note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## License\n\n[MIT © David Dias](LICENSE)\n","publish_time":1581950050413,"_cnpm_publish_time":1581950050413,"dist-tags":{"beta":"0.17.0","latest":"0.17.5"}}