use of org.bitcoinj.net.discovery.DnsDiscovery.DnsSeedDiscovery in project bitcoinj by bitcoinj.
the class MultiplexingDiscovery method forServices.
/**
* Builds a suitable set of peer discoveries.
* @param params Network to use.
* @param services Required services as a bitmask, e.g. {@link VersionMessage#NODE_NETWORK}.
* @param parallelQueries When true, seeds are queried in parallel
* @param shufflePeers When true, queried peers are shuffled
*/
public static MultiplexingDiscovery forServices(NetworkParameters params, long services, boolean parallelQueries, boolean shufflePeers) {
List<PeerDiscovery> discoveries = new ArrayList<>();
HttpDiscovery.Details[] httpSeeds = params.getHttpSeeds();
if (httpSeeds != null) {
OkHttpClient httpClient = new OkHttpClient();
for (HttpDiscovery.Details httpSeed : httpSeeds) discoveries.add(new HttpDiscovery(params, httpSeed, httpClient));
}
String[] dnsSeeds = params.getDnsSeeds();
if (dnsSeeds != null)
for (String dnsSeed : dnsSeeds) discoveries.add(new DnsSeedDiscovery(params, dnsSeed));
return new MultiplexingDiscovery(params, discoveries, parallelQueries, shufflePeers);
}
Aggregations