Files
Chad Paulson 6c8c581517 Implement SwiftTorrent: pure Swift BitTorrent library
Full BEP-3 peer wire protocol, BEP-5 DHT, BEP-15 UDP trackers,
magnet link support, bencode serialization, rarest-first piece
selection, and async session management using SwiftNIO and
swift-crypto. Includes 64 passing unit tests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 04:17:43 -06:00

30 lines
844 B
Swift

import Foundation
/// Current state of a torrent.
public enum TorrentState: String, Sendable {
case checkingFiles = "checking_files"
case downloadingMetadata = "downloading_metadata"
case downloading
case seeding
case paused
case stopped
case error
}
/// A snapshot of a torrent's current status.
public struct TorrentStatus: Sendable {
public let infoHash: InfoHash
public let name: String
public let state: TorrentState
public let progress: Double // 0.0 to 1.0
public let downloadRate: Double // bytes per second
public let uploadRate: Double
public let totalDownloaded: Int64
public let totalUploaded: Int64
public let totalSize: Int64
public let numPeers: Int
public let numSeeds: Int
public let piecesCompleted: Int
public let piecesTotal: Int
}