{"name":"peer-info","version":"0.17.0","description":"IPFS Peer abstraction JavaScript implementation","leadMaintainer":"Vasco Santos <vasco.santos@moxy.studio>","main":"src/index.js","scripts":{"lint":"aegir lint","build":"aegir build","test":"aegir test","test:node":"aegir test -t node","test:browser":"aegir test -t browser","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":{"aegir":"^20.0.0","buffer-loader":"0.1.0","bundlesize":"~0.18.0","chai":"^4.2.0","dirty-chai":"^2.0.1"},"dependencies":{"mafmt":"^6.0.9","multiaddr":"^7.1.0","peer-id":"~0.13.2","unique-by":"^1.0.0"},"contributors":[{"name":"Arnaud","email":"arnaud.valensi@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":"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":"8189e6d538f794f4b7364e64c9fda33a7cf4291e","_id":"peer-info@0.17.0","_nodeVersion":"10.15.1","_npmVersion":"6.11.3","dist":{"integrity":"sha512-H0+3XAsC7d+S5Vkgo7rLIn57I8AWA8wPOIJOgbY/QNk2wPVAXkYizc+X+FnlD2Xi7vJXGQJCbW3Czcgm5ooAHg==","shasum":"7032d073520ef07f98b213c5704b5f8c38649539","tarball":"http://registry-npm.ywwl.com/peer-info/download/peer-info-0.17.0.tgz","fileCount":12,"unpackedSize":5315112,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdg5A0CRA9TVsSAnZWagAAlEQQAIKbdHSwly7hLUmvrwq3\n+i68YXgyckEiuz1EdpI4ARSpyYJrZr2CnyfJ33HqCxjWwUgvCoNYzU/r0LXd\nEQ45a5QC0Ixc7VcIWb2xEAzpgbwMYBY+TvvxzR4If8ToRiYYra8wZbm0/9Z2\nXBcXNp0ce/ctBRzCRgdwf+gGN422ojpQP9vniypcLn8pMnKrCDgEwJqX1vbe\na/UZ6NUSYkPM2L0z3f2qL2bWBff92pej4qyNxOEZ1+KRZ06AQPZEwNZ0fPRK\nUOYuVciPW3a4zaExaQxtEbJ9nWvUgb8yLTzZG48RgrxiDsGMtRMziJXjjO3x\n866WpK7XTUQPst8XWXKCC+LY2bm/yca3Scvb9mL0dZvqi7VISo3M9G/HVIhZ\nkrKDE8r7W2Z2tyqyM5UF6atmzaVhFSnfsQQmIav5z9Rnl3YonKD6G8XN1EO0\n/h1r5RQGZKa1A77iZ2CLTft27wloItP91bpv11dCYAknrf0YjY/WaPU0sSBw\nIeWW29dYw+qC37NL9gr6rqD4fIZcGNmR+CbCO0S6+GksaTKeu65kMpZe2wj0\nBOUkVYc3pkgRsWYd+P1jqZ1BAx5Pn0QXFqufoMN5mGnnyXLk7DXK3scYCgK9\nkYMg1ri/LI6+48CjYDN9OzszPNUo150h9GV10PY+LJx+Njl1DFb/oGZPC86h\nuy77\r\n=1uf7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZn3yY65Lq/mqe0Wn677L5ZDZnCBRZZMhRiPRLUB3EtQIgHCUXuCjRNMVoyHjzvKVSO6iAmt2rmcWOWaTjFdItWsI="}],"size":1284612,"noattachment":false,"key":"/peer-info/-/peer-info-0.17.0.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.0_1568903220282_0.06698453228941381"},"_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":1568903220505,"_cnpm_publish_time":1568903220505,"dist-tags":{"beta":"0.17.0","latest":"0.17.5"}}