com.google.bitcoin.core
Class DnsDiscovery

java.lang.Object
  extended by com.google.bitcoin.core.DnsDiscovery
All Implemented Interfaces:
PeerDiscovery

public class DnsDiscovery
extends Object
implements PeerDiscovery

Supports peer discovery through DNS.

This class does not support the testnet as currently there are no DNS servers providing testnet hosts. If this class is being used for testnet you must specify the hostnames to use.

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().


Constructor Summary
DnsDiscovery(NetworkParameters netParams)
          Supports finding peers through DNS A records.
DnsDiscovery(String[] hostNames, NetworkParameters netParams)
          Supports finding peers through DNS A records.
 
Method Summary
static String[] getDefaultHostNames()
          Returns the well known discovery host names on the production network.
 InetSocketAddress[] getPeers()
          Returns an array of addresses.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DnsDiscovery

public DnsDiscovery(NetworkParameters netParams)
Supports finding peers through DNS A records. Community run DNS entry points will be used.

Parameters:
netParams - Network parameters to be used for port information.

DnsDiscovery

public DnsDiscovery(String[] hostNames,
                    NetworkParameters netParams)
Supports finding peers through DNS A records.

Parameters:
hostNames - Host names to be examined for seed addresses.
netParams - Network parameters to be used for port information.
Method Detail

getPeers

public InetSocketAddress[] getPeers()
                             throws PeerDiscoveryException
Description copied from interface: PeerDiscovery
Returns an array of addresses. This method may block.

Specified by:
getPeers in interface PeerDiscovery
Throws:
PeerDiscoveryException

getDefaultHostNames

public static String[] getDefaultHostNames()
Returns the well known discovery host names on the production network.



Copyright © 2011. All Rights Reserved.