Package org.bitcoinj.net.discovery
Class HttpDiscovery
java.lang.Object
org.bitcoinj.net.discovery.HttpDiscovery
- All Implemented Interfaces:
PeerDiscovery
A class that knows how to read signed sets of seeds over HTTP, using a simple protobuf based protocol. See the
peerseeds.proto file for the definition, with a gzipped delimited SignedPeerSeeds being the root of the data.
This is not currently in use by the Bitcoin community, but rather, is here for experimentation.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionHttpDiscovery(NetworkParameters params, URI uri, ECKey pubkey) Constructs a discovery object that will read data from the given HTTP[S] URI and, if a public key is provided, will check the signature using that key.HttpDiscovery(NetworkParameters params, HttpDiscovery.Details details) Constructs a discovery object that will read data from the given HTTP[S] URI and, if a public key is provided, will check the signature using that key.HttpDiscovery(NetworkParameters params, HttpDiscovery.Details details, okhttp3.OkHttpClient client) -
Method Summary
Modifier and TypeMethodDescriptionQueries the addresses.voidshutdown()Stops any discovery in progress when we want to shut down quickly.
-
Constructor Details
-
HttpDiscovery
Constructs a discovery object that will read data from the given HTTP[S] URI and, if a public key is provided, will check the signature using that key. -
HttpDiscovery
Constructs a discovery object that will read data from the given HTTP[S] URI and, if a public key is provided, will check the signature using that key. -
HttpDiscovery
public HttpDiscovery(NetworkParameters params, HttpDiscovery.Details details, okhttp3.OkHttpClient client)
-
-
Method Details
-
getPeers
public List<InetSocketAddress> getPeers(long services, long timeoutValue, TimeUnit timeoutUnit) throws PeerDiscoveryException Description copied from interface:PeerDiscoveryQueries the addresses. This method may block.- Specified by:
getPeersin interfacePeerDiscovery- Parameters:
services- Required services as a bitmask, e.g.VersionMessage.NODE_NETWORK.- Throws:
PeerDiscoveryException
-
protoToAddrs
public List<InetSocketAddress> protoToAddrs(PeerSeedProtos.SignedPeerSeeds proto) throws PeerDiscoveryException, com.google.protobuf.InvalidProtocolBufferException, SignatureDecodeException, SignatureException - Throws:
PeerDiscoveryExceptioncom.google.protobuf.InvalidProtocolBufferExceptionSignatureDecodeExceptionSignatureException
-
shutdown
public void shutdown()Description copied from interface:PeerDiscoveryStops any discovery in progress when we want to shut down quickly.- Specified by:
shutdownin interfacePeerDiscovery
-