Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
A PeerInfo object contains information about a PeerID and its multiaddrs. This module is used by IPFS and libp2p.
const PeerInfo = require('peer-info')
const multiaddr = require('multiaddr')
const peer = new PeerInfo()
// TCP port 5001
peer.multiaddr.add(multiaddr('/ip4/1.2.3.4/tcp/5001'))
// UDP port 8001
peer.multiaddr.add(multiaddr('/ip4/1.2.3.4/udp/8001'))
// mic/speaker soundwaves using frequencies 697 and 1209
peer.multiaddr.add(multiaddr('/sonic/bfsk/697/1209'))
const PeerInfo = require('peer-info')
Creates a new PeerInfo instance and also generates a new underlying PeerID for it.
Creates a new PeerInfo instance from an existing PeerID.
A list of multiaddresses instances that peer
can be reached at.
Adds a new multiaddress that peer
can be reached at. addr
is an instance of
a multiaddr.
The addSafe
call, in comparison to add
, will only add the multiaddr to
multiaddrs
if the same multiaddr tries to be added twice.
This is a simple mechanism to prevent multiaddrs
from becoming bloated with
unusable addresses, which happens when we exchange observed multiaddrs with
peers which will not provide a useful multiaddr to be shared to the rest of the
network (e.g. a multiaddr referring to a peer inside a LAN being shared to the
outside world).
Removes a multiaddress instance addr
from peer
.
Removes the array of multiaddresses existing
from peer
, and adds the array
of multiaddresses fresh
.
> npm i peer-info
var PeerInfo = require('peer-info')
<script>
TagLoading this module through a script tag will make the PeerInfo
obj available in the global namespace.
<script src="https://npmcdn.com/peer-info/dist/index.min.js"></script>
<!-- OR -->
<script src="https://npmcdn.com/peer-info/dist/index.js"></script>
MIT
FAQs
IPFS Peer abstraction JavaScript implementation
The npm package peer-info receives a total of 6,370 weekly downloads. As such, peer-info popularity was classified as popular.
We found that peer-info demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.