PexPeer

data class PexPeer(val ip: ByteArray, val port: Int, val flags: Int = 0)

One peer advertised in (or dropped from) a PEX message.

The address is kept as raw network-byte-order ip bytes (4 for IPv4, 16 for IPv6) plus the port, exactly as it appears on the wire. This codec does no string formatting and no DNS. host renders a dotted-quad or colon-hex literal for convenience and tests.

Constructors

Link copied to clipboard
constructor(ip: ByteArray, port: Int, flags: Int = 0)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val flags: Int

the PexFlags bits; 0 for dropped peers (which carry none).

Link copied to clipboard

The address as a literal string: dotted-quad for IPv4, fully-expanded colon-hex for IPv6. There is no :: compression, so the form is unambiguous and round-trips.

Link copied to clipboard

"host:port" with the host literal, for logging and tests.

Link copied to clipboard

the address bytes, length 4 (IPv4) or 16 (IPv6), big-endian.

Link copied to clipboard

True if this peer's flags mark it a seed (PexFlags.SEED).

Link copied to clipboard

True if this is an IPv4 (4-byte) address.

Link copied to clipboard

True if this is an IPv6 (16-byte) address.

Link copied to clipboard
val port: Int

the TCP port, 0..65535.

Link copied to clipboard

True if this peer's flags advertise BitTorrent encryption (PexFlags.ENCRYPTION).

Link copied to clipboard

True if this peer's flags advertise hole-punch support (PexFlags.HOLEPUNCH); positive-only.

Link copied to clipboard

True if this peer's flags advertise uTP support (PexFlags.UTP); positive-only.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String