Package-level declarations

Types

Link copied to clipboard
class ConnectionBudget(limit: Int)

The session-wide connection cap, the enforcement half of libtorrent's connections_limit setting (session_impl::m_settings, default 200).

Link copied to clipboard
class KiteTorrentEngine(scope: CoroutineScope, val peerId: Sha1Hash = generatePeerId(), val listenPort: Int = 6881, httpTracker: HttpTracker? = null, enableDht: Boolean = false, enableUtp: Boolean = false, clock: () -> Long = { 0L }, val settings: SettingsPack = SettingsPack(), httpClient: HttpClient? = null, gateway: String? = null)

The top-level engine, the KiteTorrent equivalent of libtorrent's session. It owns the shared NetworkRuntime, the RateLimiter, the ConnectionBudget, an optional DhtNode and UtpSocketManager, and the set of active TorrentSessions. This is the single object an app talks to.

Link copied to clipboard
class RateLimiter(scope: CoroutineScope, updateIntervalMs: Long = 250)

Session-wide upload/download rate limiting: the live driver for the pure BandwidthManager/BandwidthChannel port.

Link copied to clipboard

The pure "stop seeding?" decision. This is the port of libtorrent's share-ratio and seed-time limit checks (session_impl::recalculate_auto_managed_torrents, torrent::seed_ratio / is_seed_limit_reached). Kept side-effect-free so the policy is exhaustively unit-testable; io.github.yuroyami.kitetorrent.session.engine.TorrentSession consults it on its maintenance tick and pauses when it returns true.

Link copied to clipboard

A torrent's upload/download token-bucket pair, layered under the session-global channels the way libtorrent stacks bandwidth_channels (global → torrent) in a peer's request. Limits of 0 = unlimited.

Link copied to clipboard
class TorrentSession(val torrent: TorrentInfo, val disk: DiskIo, network: NetworkRuntime, scope: CoroutineScope, val peerId: Sha1Hash = generatePeerId(), val listenPort: Int = 6881, httpTracker: HttpTracker? = null, var maxPeers: Int = 50, tickIntervalMs: Long = 1000, settings: SettingsPack = SettingsPack(), utp: UtpSocketManager? = null, limiter: RateLimiter? = null, torrentBandwidth: TorrentBandwidth? = null, connections: ConnectionBudget? = null, resumeData: AddTorrentParams? = null, ipFilter: IpFilter? = null)

The download/upload engine for a single torrent. It is the live counterpart of libtorrent's torrent (torrent.cpp). It wires the pure-core pieces on coroutines: announce → collect peers → run a PeerConnection per peer → a PiecePicker-driven request pipeline → write blocks to DiskIo → verify completed pieces → broadcast have → and serve blocks back to peers we've unchoked.

Link copied to clipboard

The lifecycle state of a torrent. A small port of libtorrent's torrent_status::state_t.