PeerSource

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.

In libtorrent this is a bitfield_flag<std::uint8_t, …>; we model the bitmap as a plain Int (KiteTorrent's convention of plain primitives over strong flag types). Each constant below is a single bit, and a peer's TorrentPeer.source is the bitwise OR of every source that has ever told us about it.

The numeric bit positions are load-bearing: sourceRank depends on them, and so does any future serialization, so they must stay exactly as upstream defines them.

Properties

Link copied to clipboard
const val DHT: Int

The peer was received from the DHT. 1_bit.

Link copied to clipboard
const val INCOMING: Int

The peer connected to us (an incoming connection). 5_bit.

Link copied to clipboard
const val LSD: Int

The peer was received through local service discovery (LSD). 3_bit.

Link copied to clipboard
const val PEX: Int

The peer was received through peer exchange (PEX). 2_bit.

Link copied to clipboard
const val RESUME_DATA: Int

The peer was read back from resume data. 4_bit.

Link copied to clipboard
const val TRACKER: Int

The peer was received from a tracker announce. 0_bit.