
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@patrickkfkan/peer-ssdp
Advanced tools
Nodejs implementation of the Simple Service Discovery Protocol
Forked from https://github.com/fraunhoferfokus/peer-ssdp with the following changes:
v0.1.0:
bindToInterfaces
and bindToAddresses
options.Everything else is the original author's work.
peer-ssdp is a simple Node.js module implementing the Simple Service Discovery Protocol SSDP as described in the UPnP Device Architecture specification, Section 1
npm install peer-ssdp
to install the module.node node_modules/peer-ssdp/test/ssdp-test.js
Peer is an EventEmitter
so you can use the common EventEmitter
API to subscribe to specific events.
var ssdp = require("peer-ssdp");
var peer = ssdp.createPeer();
var interval;
/**
* handle peer ready event. This event will be emitted after `peer.start()` is called.
*/
peer.on("ready",function(){
// handle ready event
// send ssdp:alive messages every 1s
// {{networkInterfaceAddress}} will be replaced before
// sending the SSDP message with the actual IP Address of the corresponding
// Network interface. This is helpful for example in UPnP for LOCATION value
interval = setInterval(function(){
peer.alive({
ST: "upnp:rootdevice",
SERVER: "...",
ST: headers.ST,
USN: "...",
LOCATION: "http://{{networkInterfaceAddress}}/device-desc.xml",
});
}, 1000);
// shutdown peer after 10 s and send a ssdp:byebye message before
setTimeout(function(){
clearInterval(interval);
// Close peer. Afer peer is closed the `close` event will be emitted.
peer.close();
}, 10000);
});
// handle SSDP NOTIFY messages.
// param headers is JSON object containing the headers of the SSDP NOTIFY message as key-value-pair.
// param address is the socket address of the sender
peer.on("notify",function(headers, address){
// handle notify event
});
// handle SSDP M-SEARCH messages.
// param headers is JSON object containing the headers of the SSDP M-SEARCH message as key-value-pair.
// param address is the socket address of the sender
peer.on("search",function(headers, address){
// handle search request
// reply to search request
// Also here the {{networkInterfaceAddress}} will be replaced before
// sending the SSDP message with the actual IP Address of the corresponding
// Network interface.
peer.reply({
ST: "upnp:rootdevice",
SERVER: "...",
ST: headers.ST,
USN: "...",
LOCATION: "http://{{networkInterfaceAddress}}/device-desc.xml",
},address);
});
// handle SSDP HTTP 200 OK messages.
// param headers is JSON object containing the headers of the SSDP HTTP 200 OK message as key-value-pair.
// param address is the socket address of the sender
peer.on("found",function(headers, address){
// handle found event
});
// handle peer close event. This event will be emitted after `peer.close()` is called.
peer.on("close",function(){
// handle close event
});
// Start peer. Afer peer is ready the `ready` event will be emitted.
peer.start();
GNU Lesser General Public License v3.0, for more details please refer to the LICENSE file.
Contact us at famecontact@fokus.fraunhofer.de
Copyright (c) 2017 Fraunhofer FOKUS
FAQs
Nodejs implementation of the Simple Service Discovery Protocol
We found that @patrickkfkan/peer-ssdp 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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.