Search for a key across multiple discovery networks and find peers who answer.
Currently searches across and advertises on the Bittorrent DHT, centralized DNS servers and Multicast DNS simultaneously.
Uses the bittorrent-dht and dns-discovery modules.
Also check out discovery-swarm which adds connection management on top of this module.
Returns a constructor
Returns a new instance. opts is optional and can have the following properties:
dns- defaultundefined, iffalsewill disablednsdiscovery, any other value type will be passed to thedns-discoveryconstructordht- defaultundefined, iffalsewill disabledhtdiscovery, any other value type will be passed to thebittorrent-dhtconstructor
By default hashes are re-announced around every 10 min on the dht and 1 min using dns. Set dht.interval or dns.interval to change these.
Perform a lookup across all networks for id. id can be a buffer or a string.
Specify port if you want to announce that you share id as well.
Stop looking for id. id can be a buffer or a string.
Specify port to stop announcing that you share id as well.
Force announce / lookup all joined hashes
List all the channels you have joined. The returned array items look like this
{
id: <Buffer>,
port: <port you are announcing>
}Emitted when a peer answers your query.
idis the id (as a buffer) this peer was discovered forpeeris the peer that was discovered{port: port, host: host}typeis the network type (one of['dht', 'dns'])
Stops all lookups and advertisements and call cb when done.
Emitted when the channel is destroyed