Package-level declarations

Types

Link copied to clipboard
data class ClientInfo(val name: String, val code: String, val style: ClientStyle, val major: Int, val minor: Int, val revision: Int, val tag: Int)

A decoded peer-id fingerprint: the port of libtorrent's fingerprint struct as produced by parse_az_style / parse_shadow_style / parse_mainline_style.

Link copied to clipboard

Which peer-id encoding a ClientInfo was decoded from.

Link copied to clipboard
class ExternalIp(externalV4: PeerAddress? = null, externalV6: PeerAddress? = null)

Our externally-visible IP address: the slimmed port of libtorrent's external_ip (include/libtorrent/ip_voter.hpp) for what the peer list actually needs.

Link copied to clipboard
class IpFilter

A set of rules that uniquely categorises every IP address as allowed or blocked. The port of libtorrent::ip_filter (src/ip_filter.cpp, include/libtorrent/ip_filter.hpp).

Link copied to clipboard
class IpRange

One coalesced range exported by RangeFilter.exportRanges. This is the port of libtorrent::ip_range<Addr> reduced to its raw form. first and last are inclusive big-endian keys (4/16 bytes for an IP, 2 for a port) and flags the access flags (IpFilter.BLOCKED or 0).

Link copied to clipboard

A parsed IP address: the pure-Kotlin stand-in for libtorrent's libtorrent::address (Boost.Asio) inside the peer-list port.

Link copied to clipboard
class PeerList

The set of known peers for one torrent. This is the pure-Kotlin port of libtorrent's struct peer_list (include/libtorrent/peer_list.hpp, src/peer_list.cpp).

Link copied to clipboard
object PeerSource

The set of "where did we learn about this peer" flags: the pure-Kotlin port of the peer_source_flags_t constants in include/libtorrent/peer_info.hpp.

Link copied to clipboard
object PexFlags

The "peer exchange" hint flags that can accompany a peer when it is added: the port of the pex_flags_t constants in include/libtorrent/pex_flags.hpp.

Link copied to clipboard

Maps non-overlapping port ranges to access flags. This is the port of libtorrent::port_filter (src/ip_filter.cpp, include/libtorrent/ip_filter.hpp).

Link copied to clipboard
class TorrentPeer(val host: String, port: Int, connectable: Boolean, source: Int)

A single known peer of a torrent. The pure-Kotlin port of libtorrent's struct torrent_peer (include/libtorrent/torrent_peer.hpp, src/torrent_peer.cpp).

Link copied to clipboard

State the owning torrent passes into PeerList operations. This is the port of struct torrent_state (include/libtorrent/peer_list.hpp).

Functions

Link copied to clipboard

Map a 20-byte peer-id to a human-readable client name and version: the port of libtorrent's identify_client (aux::identify_client_impl).

Link copied to clipboard

Structured peer-id fingerprint extraction: the port of libtorrent's client_fingerprint. Recognises only the three well-formed styles (Azureus, Shadow, Mainline) and returns null for everything else (including the non-standard special cases that identifyClient still names).

Link copied to clipboard
fun peerPriority(addr1: PeerAddress, port1: Int, addr2: PeerAddress, port2: Int): Int

Compute the BEP 40 peer priority of the (ordered) pair of endpoints (addr1:port1) and (addr2:port2). This is the pure-Kotlin port of std::uint32_t peer_priority(tcp::endpoint, tcp::endpoint) from src/torrent_peer.cpp. One endpoint should be our own and the other the peer's. The function is symmetric, so which is which does not matter.

Link copied to clipboard
fun sourceRank(source: Int): Int

Compute the source rank of a peer's source bitmap: the port of int source_rank(peer_source_flags_t) from src/request_blocks.cpp.