tuweni / org.apache.tuweni.devp2p.v5 / DiscoveryV5Service

DiscoveryV5Service

interface DiscoveryV5Service : CoroutineScope (source)

Service executes network discovery, according to discv5 specification (https://github.com/ethereum/devp2p/blob/master/discv5/discv5.md)

Functions

addPeer

Adds a peer to the routing table.

open suspend fun addPeer(rlpENR: Bytes): AsyncCompletion
abstract suspend fun addPeer(enr: EthereumNodeRecord, address: SocketAddress = SocketAddress.inetSocketAddress(enr.udp()!!, enr.ip().hostAddress)): AsyncCompletion

enr

Provides the ENR identifying the service.

abstract fun enr(): EthereumNodeRecord

requestNodes

Requests nodes from all connected peers.

abstract suspend fun requestNodes(distance: Int = 1, maxSecondsToWait: Long = 10): AsyncResult<Map<EthereumNodeRecord, List<EthereumNodeRecord>>>

start

Starts the node discovery service.

abstract suspend fun start(): AsyncCompletion

startAsync

Starts the discovery service, providing a handle to the completion of the start operation.

open fun startAsync(): AsyncCompletion

terminate

Stops the node discovery service.

abstract suspend fun terminate(): Unit

terminateAsync

Stops the node discovery service, providing a handle to the completion of the shutdown operation.

open fun terminateAsync(): AsyncCompletion