public class DnsDiscovery extends MultiplexingDiscovery
Supports peer discovery through DNS.
Failure to resolve individual host names will not cause an Exception to be thrown. However, if all hosts passed fail to resolve a PeerDiscoveryException will be thrown during getPeers().
DNS seeds do not attempt to enumerate every peer on the network. MultiplexingDiscovery.getPeers(long, long, TimeUnit)
will return up to 30 random peers from the set of those returned within the timeout period. If you want more peers
to connect to, you need to discover them via other means (like addr broadcasts).
Modifier and Type | Class and Description |
---|---|
static class |
DnsDiscovery.DnsSeedDiscovery
Implements discovery from a single DNS host.
|
netParams, seeds
Constructor and Description |
---|
DnsDiscovery(NetworkParameters netParams)
Supports finding peers through DNS A records.
|
DnsDiscovery(java.lang.String[] dnsSeeds,
NetworkParameters params)
Supports finding peers through DNS A records.
|
Modifier and Type | Method and Description |
---|---|
protected java.util.concurrent.ExecutorService |
createExecutor() |
forServices, forServices, getPeers, shutdown
public DnsDiscovery(NetworkParameters netParams)
netParams
- Network parameters to be used for port information.public DnsDiscovery(java.lang.String[] dnsSeeds, NetworkParameters params)
dnsSeeds
- Host names to be examined for seed addresses.params
- Network parameters to be used for port information.protected java.util.concurrent.ExecutorService createExecutor()
createExecutor
in class MultiplexingDiscovery