public class TorDiscovery extends Object implements PeerDiscovery
Supports peer discovery through Tor.
Failure to obtain at least four different peers through different exit nodes will cause a PeerDiscoveryException will be thrown during getPeers().
DNS seeds do not attempt to enumerate every peer on the network. If you want more peers to connect to, you need to discover them via other means (like addr broadcasts).
Modifier and Type | Field and Description |
---|---|
static int |
MINIMUM_ROUTER_COUNT |
static int |
MINIMUM_ROUTER_LOOKUP_COUNT |
static int |
RECEIVE_RETRIES |
static int |
RESOLVE_CNAME |
static int |
RESOLVE_ERROR |
static int |
RESOLVE_IPV4 |
static int |
RESOLVE_IPV6 |
static int |
RESOLVE_STREAM_ID |
static int |
ROUTER_LOOKUP_COUNT |
Constructor and Description |
---|
TorDiscovery(NetworkParameters netParams,
com.subgraph.orchid.TorClient torClient)
Supports finding peers through Tor.
|
TorDiscovery(String[] hostNames,
NetworkParameters netParams,
com.subgraph.orchid.TorClient torClient)
Supports finding peers through Tor.
|
Modifier and Type | Method and Description |
---|---|
InetSocketAddress[] |
getPeers(long timeoutValue,
TimeUnit timeoutUnit)
Returns an array of addresses.
|
void |
shutdown()
Stops any discovery in progress when we want to shut down quickly.
|
public static final int MINIMUM_ROUTER_COUNT
public static final int ROUTER_LOOKUP_COUNT
public static final int MINIMUM_ROUTER_LOOKUP_COUNT
public static final int RECEIVE_RETRIES
public static final int RESOLVE_STREAM_ID
public static final int RESOLVE_CNAME
public static final int RESOLVE_ERROR
public static final int RESOLVE_IPV4
public static final int RESOLVE_IPV6
public TorDiscovery(NetworkParameters netParams, com.subgraph.orchid.TorClient torClient)
netParams
- Network parameters to be used for port information.public TorDiscovery(String[] hostNames, NetworkParameters netParams, com.subgraph.orchid.TorClient torClient)
hostNames
- Host names to be examined for seed addresses.netParams
- Network parameters to be used for port information.torClient
- an already-started Tor client.public InetSocketAddress[] getPeers(long timeoutValue, TimeUnit timeoutUnit) throws PeerDiscoveryException
PeerDiscovery
getPeers
in interface PeerDiscovery
PeerDiscoveryException
public void shutdown()
PeerDiscovery
shutdown
in interface PeerDiscovery
Copyright © 2014. All rights reserved.