Companion

object Companion

Properties

Link copied to clipboard
const val V4_SIZE: Int = 6

Compact size of an IPv4 endpoint: 4-byte address + 2-byte port.

Link copied to clipboard
const val V6_SIZE: Int = 18

Compact size of an IPv6 endpoint: 16-byte address + 2-byte port.

Functions

Link copied to clipboard
fun decodeV4(buf: ByteArray, offset: Int = 0): DhtEndpoint

Decode a 6-byte IPv4 endpoint from buf at offset: a port of aux::read_v4_endpoint.

Link copied to clipboard
fun decodeV6(buf: ByteArray, offset: Int = 0): DhtEndpoint

Decode an 18-byte IPv6 endpoint from buf at offset: a port of aux::read_v6_endpoint.

Link copied to clipboard
fun of(host: String, port: Int): DhtEndpoint?

Build a DhtEndpoint from a host literal and port, or null if host is not a parseable IPv4/IPv6 literal. Convenience bridge from the string-host world (NodeEntry.host) to the compact world.