Local Service Discovery (BEP14) implementation
npm install bittorrent-lsd[ci-image]: https://github.com/webtorrent/bittorrent-lsd/actions/workflows/ci.yml/badge.svg?branch=master
[ci-url]: https://github.com/webtorrent/bittorrent-lsd/actions/workflows/ci.yml
[npm-image]: https://img.shields.io/npm/v/bittorrent-lsd.svg
[npm-url]: https://npmjs.org/package/bittorrent-lsd
[downloads-image]: https://img.shields.io/npm/dm/bittorrent-lsd.svg
[downloads-url]: https://npmjs.org/package/bittorrent-lsd
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
Local Service Discovery (LSD) provides a SSDP-like (http over udp-multicast) mechanism to announce the presence in specific swarms to local neighbors.
This module is used by WebTorrent.
```
npm install bittorrent-lsd
`
const opts = {
peerId: new Buffer('01234567890123456789'), // hex string or Buffer
infoHash: new Buffer('01234567890123456789'), // hex string or Buffer
port: common.randomPort() // torrent client port
}
const lsd = new LSD(opts)
// start getting peers from local network
lsd.start()
lsd.on('peer', (peerAddress, infoHash) => {
console.log('found a peer: ' + peerAddress)
})
lsd.destroy()
`
instance.$3
Start listening and sending (every 5 minutes) for local network announces.$3
Destroy the LSD. Closes the socket and cleans up resources.events
$3
Emitted when a potential peer is found. peerAddress is of the form host:port. infoHash` is the torrent info hash.MIT. Copyright (c) Julen Garcia Leunda and WebTorrent, LLC.