tuweni / org.apache.tuweni.devp2p / Peer

Peer

interface Peer (source)

An Ethereum P2P network peer.

Properties

endpoint

The endpoint for communicating with this peer, if known.

abstract val endpoint: Endpoint

enr

The Ethereum Node Record associated with the peer, if known.

abstract val enr: EthereumNodeRecord?

lastSeen

The time this peer was last seen at its current endpoint, in milliseconds since the epoch.

abstract val lastSeen: Long?

lastVerified

The last time the current endpoint of this peer was verified, in milliseconds since the epoch.

abstract val lastVerified: Long?

nodeId

The nodeId for this peer.

abstract val nodeId: PublicKey

Functions

getEndpoint

Get the endpoint for this peer, if it has been verified on or after a specified time.

abstract fun getEndpoint(ifVerifiedOnOrAfter: Long): Endpoint?

seenAt

Set the lastSeen time to the current time.

abstract fun seenAt(time: Long): Unit

updateEndpoint

Update the peer with a new endpoint.

abstract fun updateEndpoint(endpoint: Endpoint, time: Long, ifVerifiedBefore: Long? = null): Endpoint

updateENR

Update the peer's ENR.

abstract fun updateENR(record: EthereumNodeRecord, time: Long): Unit

uri

open fun uri(): String

verifyEndpoint

Set the lastVerified and lastSeen time to the provided time, if the endpoint matches.

abstract fun verifyEndpoint(endpoint: Endpoint, time: Long): Boolean