tuweni / org.apache.tuweni.devp2p / DiscoveryService / open

open

@JvmOverloads fun open(vertx: Vertx, 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: String? = null, advertiseUdpPort: Int? = null, advertiseTcpPort: Int? = null, routingTable: PeerRoutingTable = DevP2PPeerRoutingTable(keyPair.publicKey()), packetFilter: ((PublicKey, SocketAddress) -> Boolean)? = null, timeSupplier: () -> Long = CURRENT_TIME_SUPPLIER): DiscoveryService (source)

Start the discovery service.

Parameters

vertx - Vert.x instance

keyPair - the local node's keypair

port - the port to listen on (defaults to 0, which will cause a random free port to be chosen)

host - the host name or IP address of the interface to bind to (defaults to null, which will cause the service to listen on all interfaces

seq - the sequence number of the Ethereum Node Record

enrData - the additional key/value pair entries to broadcast as an Ethereum Node Record (ENR).

bootstrapURIs - the URIs for bootstrap nodes

peerRepository - a PeerRepository for obtaining Peer instances

advertiseAddress - the IP address to advertise to peers, or null if the address of the first bound interface should be used.

advertiseUdpPort - the UDP port to advertise to peers, or null if the bound port should to be used.

advertiseTcpPort - the TCP port to advertise to peers, or null if it should be the same as the UDP port.

routingTable - a PeerRoutingTable which handles the ÐΞVp2p routing table

packetFilter - a filter for incoming packets \ * @param bufferAllocator a ByteBuffer allocator, which must return buffers of size 1280 bytes or larger

timeSupplier - a function supplying the current time, in milliseconds since the epoch

@JvmOverloads fun open(vertx: Vertx, keyPair: KeyPair, bindAddress: SocketAddress, seq: Long = Instant.now().toEpochMilli(), enrData: Map<String, Bytes> = emptyMap(), bootstrapURIs: List<URI> = emptyList(), peerRepository: PeerRepository = EphemeralPeerRepository(), advertiseAddress: String? = null, advertiseUdpPort: Int? = null, advertiseTcpPort: Int? = null, routingTable: PeerRoutingTable = DevP2PPeerRoutingTable(keyPair.publicKey()), packetFilter: ((PublicKey, SocketAddress) -> Boolean)? = null, timeSupplier: () -> Long = CURRENT_TIME_SUPPLIER): DiscoveryService (source)

Start the discovery service.

Parameters

vertx - Vert.x instance

keyPair - the local node's keypair

bindAddress - the address to listen on

seq - the sequence number of the Ethereum Node Record

enrData - the additional key/value pair entries to broadcast as an Ethereum Node Record (ENR).

bootstrapURIs - the URIs for bootstrap nodes

peerRepository - a PeerRepository for obtaining Peer instances

advertiseAddress - the IP address to advertise for incoming packets

advertiseUdpPort - the UDP port to advertise to peers, or null if the bound port should to be used.

advertiseTcpPort - the TCP port to advertise to peers, or null if it should be the same as the UDP port.

routingTable - a PeerRoutingTable which handles the ÐΞVp2p routing table

packetFilter - a filter for incoming packets

timeSupplier - a function supplying the current time, in milliseconds since the epoch