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

open

@JvmOverloads 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 (source)

Start the discovery service.

Parameters

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

loggerProvider - a provider for a logger

channelGroup - the CoroutineChannelGroup for network channels created by this service

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(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 (source)

Start the discovery service.

Parameters

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

loggerProvider - a provider for a logger

channelGroup - the CoroutineChannelGroup for network channels created by this service

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