{"name":"peer-info","version":"0.9.4","description":"IPFS Peer abstraction JavaScript implementation","main":"src/index.js","scripts":{"lint":"aegir-lint","build":"aegir-build","test":"aegir-test","test:node":"aegir-test --env node","test:browser":"aegir-test --env browser","release":"aegir-release","release-minor":"aegir-release --type minor","release-major":"aegir-release --type major","coverage":"aegir-coverage","coverage-publish":"aegir-coverage publish"},"repository":{"type":"git","url":"git+https://github.com/libp2p/js-peer-info.git"},"keywords":["IPFS"],"engines":{"node":">=4.0.0"},"author":{"name":"David Dias","email":"daviddias@ipfs.io"},"license":"MIT","bugs":{"url":"https://github.com/libp2p/js-peer-info/issues"},"homepage":"https://github.com/libp2p/js-peer-info","pre-commit":["lint","test"],"devDependencies":{"aegir":"^11.0.2","buffer-loader":"0.0.1","chai":"^4.1.0","dirty-chai":"^2.0.1","pre-commit":"^1.2.2"},"dependencies":{"multiaddr":"^2.3.0","lodash.uniqby":"^4.7.0","peer-id":"^0.8.8"},"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":"Richard Littauer","email":"richard.littauer@gmail.com"},{"name":"Sid Harder","email":"sideharder@gmail.com"},{"name":"Stephen Whitmore","email":"stephen.whitmore@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"}],"gitHead":"6bef1456bd4d0d678bcd61c6dcb39924c4c2c703","_id":"peer-info@0.9.4","_shasum":"21b0e9a1d5c19cf6670ae1cb96e7d441e5693749","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.10.0","_npmUser":{"name":"daviddias","email":"daviddias.p@gmail.com"},"dist":{"shasum":"21b0e9a1d5c19cf6670ae1cb96e7d441e5693749","tarball":"http://registry-npm.ywwl.com/peer-info/download/peer-info-0.9.4.tgz","integrity":"sha512-104Yn0R2JTx2MCMuTSszjnm3Hlh7jnxK7+eDLuH0NwZhHzwfJ5VO58b9FYy3m/2nLD49bjr1IlZZIEbb9WC4yw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICEIqEQ7NASZKCan7ixiDGvo28gU6T6p9uMTLv9K5zsXAiEA8L9uRMmLr5DCxzPyuVD2iupXa5zfBOBQ084RO44/xHc="}],"size":620234,"noattachment":false,"key":"/peer-info/-/peer-info-0.9.4.tgz"},"maintainers":[{"name":"daviddias","email":"daviddias.p@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/peer-info-0.9.4.tgz_1500656007333_0.6797601303551346"},"directories":{},"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":1500656008890,"_cnpm_publish_time":1500656008890,"dist-tags":{"beta":"0.17.0","latest":"0.17.5"}}