interface DiscoveryService
(source)
An Ethereum ÐΞVp2p discovery service.
This service supports devp2p discovery v4, alongside support for EIP-868. http://eips.ethereum.org/EIPS/eip-868
abstract val expiredPackets: Long |
|
abstract val filteredPackets: Long |
|
abstract val invalidPackets: Long |
|
abstract val isShutdown: Boolean
|
|
abstract val isTerminated: Boolean
|
|
abstract val localPort: Int
the UDP port that the service is listening on |
|
abstract val nodeId: PublicKey
the node id for this node (i.e. it's public key) |
|
abstract val selfPackets: Long |
|
abstract val unexpectedENRResponses: Long |
|
abstract val unexpectedNeighbors: Long |
|
abstract val unexpectedPongs: Long |
|
abstract val unvalidatedPeerPackets: Long |
abstract suspend fun awaitBootstrap(): Int
Suspend until the bootstrap peers have been reached, or failed. |
|
abstract suspend fun awaitTermination(): Unit
Suspend until this service has terminated. |
|
abstract fun awaitTerminationAsync(): AsyncCompletion
Provide a completion that will complete when the service has terminated. |
|
abstract suspend fun lookup(target: PublicKey): List<Peer>
Attempt to find a specific peer, or peers close to it. |
|
abstract fun lookupAsync(target: PublicKey): AsyncResult<List<Peer>>
Attempt to find a specific peer, or peers close to it asynchronously. |
|
abstract fun shutdown(): Unit
Request shutdown of this service. The service will terminate at a later time (see DiscoveryService.awaitTermination). |
|
abstract fun shutdownNow(): Unit
Shutdown this service immediately. |
fun open(keyPair: KeyPair, port: Int = 0, host: String? = null, seq: Long = Instant.now().toEpochMilli(), enrData: Map<String, Bytes> = emptyMap(), bootstrapURIs: List<URI> = emptyList(), peerRepository: PeerRepository = EphemeralPeerRepository(), advertiseAddress: InetAddress? = null, advertiseUdpPort: Int? = null, advertiseTcpPort: Int? = null, routingTable: PeerRoutingTable = DevP2PPeerRoutingTable(keyPair.publicKey()), packetFilter: (PublicKey, InetSocketAddress) -> Boolean = null, loggerProvider: LoggerProvider = LoggerProvider.nullProvider(), channelGroup: CoroutineChannelGroup = CommonCoroutineGroup, bufferAllocator: () -> ByteBuffer = DEFAULT_BUFFER_ALLOCATOR, timeSupplier: () -> Long = CURRENT_TIME_SUPPLIER): DiscoveryService fun open(keyPair: KeyPair, bindAddress: InetSocketAddress, seq: Long = Instant.now().toEpochMilli(), enrData: Map<String, Bytes> = emptyMap(), bootstrapURIs: List<URI> = emptyList(), peerRepository: PeerRepository = EphemeralPeerRepository(), advertiseAddress: InetAddress? = null, advertiseUdpPort: Int? = null, advertiseTcpPort: Int? = null, routingTable: PeerRoutingTable = DevP2PPeerRoutingTable(keyPair.publicKey()), packetFilter: (PublicKey, InetSocketAddress) -> Boolean = null, loggerProvider: LoggerProvider = LoggerProvider.nullProvider(), channelGroup: CoroutineChannelGroup = CommonCoroutineGroup, bufferAllocator: () -> ByteBuffer = DEFAULT_BUFFER_ALLOCATOR, timeSupplier: () -> Long = CURRENT_TIME_SUPPLIER): DiscoveryService
Start the discovery service. |