
Product
Introducing Custom Tabs for Org Alerts
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.
peer-network
Advanced tools
Create servers/clients that listen on names instead of ports and hostnames and are accessible over the internet
Create servers/clients that listen on names instead of ports and hostnames and are accessible over the internet. Uses hyperdht to discover peers and holepunch connections to them.
Per default it uses bootstrap1.hyperdht.org to bootstrap the DHT but you can configure your own.
npm install peer-network
First create a server
var peernet = require('peer-network')
var network = peernet()
var server = network.createServer()
server.on('connection', function (stream) {
console.log('new connection')
stream.pipe(stream) // echo
})
server.listen('echo-server') // listen on a name
In another process (on any machine)
// will connect to a server annoucing itself as echo-server
var stream = network.connect('echo-server')
stream.write('hello world')
stream.on('data', function (data) {
console.log('data:', data.toString())
})
var network = peernet(opts)Create a new network instance. Options are forwarded to the hyperdht constructor.
If you do not provide a bootstrap list, bootstrap1.hyperdht.org is used.
var server = network.createServer([onconnection])Create a new server.
server.listen(name, [onlistening])Listen on a name. Can be any buffer/string. Optionally you can specify a port to bound to as well. If not specified a random open port will be used. The server will use discovery-channel to announce itself to other peers using multicast-dns, the bittorrent dht and potentially a series of dns servers.
server.close([onclose])Close the server and stop announcing its pressence
server.on('connection', stream)Emitted when a client connects
server.on('listening')Emitted when the server is listening.
server.on('error', err)Emitted if the server has a critical error.
server.on('close')Emitted when the server is fully close
var stream = network.connect(name)Connect to a server listening on a name. If multiple servers are listening it will connect to the first one to which an connection can be established.
stream.on('connect')Emitted when the stream is fully connected to another peer. You do not need to wait for this event before writing data to the socket.
MIT
FAQs
Create servers/clients that listen on names instead of ports and hostnames and are accessible over the internet
The npm package peer-network receives a total of 1 weekly downloads. As such, peer-network popularity was classified as not popular.
We found that peer-network demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.

Product
Create and share saved alert views with custom tabs on the org alerts page, making it easier for teams to return to consistent, named filter sets.

Product
Socket’s Rust and Cargo support is now generally available, providing dependency analysis and supply chain visibility for Rust projects.

Security News
Chrome 144 introduces the Temporal API, a modern approach to date and time handling designed to fix long-standing issues with JavaScript’s Date object.