<commit_before>use url::Url;
use bip_util::sha::ShaHash;

struct BTClient {
    torrents: Vec<Torrent>,
    id: String, // peer_id or client id
}

struct Torrent {
    // MetaInfo
    announce: Url,
    piece_length: usize,
    pieces_sha1: Vec<ShaHash>,
    name: String, // can be file or directory name
    length: Option<usize>,
    md5: Option<String>, // optional, try not to use
    files: Option<File>,

    // From/For tracker
    peers: Vec<Peer>,
    uploaded: usize,
    downloaded: usize,
    left: usize,
    interval: usize, // in seconds
    tracker_id: String,
    num_seeders: usize,
    num_leachers: usize,
}

struct File {
    path: String, // can be file or directory name
    length: usize,
    md5: Option<String>, // optional, try not to use
}

struct Peer {
    id: String, // peer_id
    ip_port: String,

    am_choking: bool,
    peer_choking: bool,
    am_interested: bool,
    peer_interested: bool,
}

impl Peer {
    fn new(id: String, ip_port: String) -> Peer {
        Peer {
            id: id,
            ip_port: ip_port,
            am_choking: true,
            am_interested: false,
            peer_choking: true,
            peer_interested: false,
        }
    }
}

struct TrackerRequest {
    info_hash: String,
    peer_id: String,
    port: usize, // port client is listening on, between 6881-6889
    uploaded: usize,
    downloaded: usize,
    left: usize,
    event: EventType, // TODO think about adding optional fields
}

enum EventType {
    Started,
    Stopped,
    Completed,
}
<commit_msg>Add new for Torrent<commit_after>use url::Url;
use bip_util::sha::ShaHash;

struct BTClient {
    torrents: Vec<Torrent>,
    id: String, // peer_id or client id
}

struct Torrent {
    // MetaInfo
    announce: Url,
    piece_length: usize,
    pieces_sha1: Vec<ShaHash>,
    name: String, // can be file or directory name
    length: Option<usize>,
    md5: Option<String>, // optional, try not to use
    files: Option<File>,

    // From/For tracker
    peers: Vec<Peer>,
    uploaded: usize,
    downloaded: usize,
    left: usize,
    interval: usize, // in seconds
    tracker_id: String,
    num_seeders: usize,
    num_leachers: usize,
}

impl Torrent {
    fn new(url: Url, plen: usize, pieces: Vec<ShaHash>) -> Torrent {
        Torrent {
            announce: url,
            piece_length: plen,
            pieces_sha1: pieces,
            name: String::new(),
            length: None,
            md5: None,
            files: None,

            peers: Vec::new(),
            uploaded: 0,
            downloaded: 0,
            left: 0,
            interval: 0, // in seconds
            tracker_id: String::new(),
            num_seeders: 0,
            num_leachers: 0,
        }
    }
}

struct File {
    path: String, // can be file or directory name
    length: usize,
    md5: Option<String>, // optional, try not to use
}

struct Peer {
    id: String, // peer_id
    ip_port: String,

    am_choking: bool,
    peer_choking: bool,
    am_interested: bool,
    peer_interested: bool,
}

impl Peer {
    fn new(id: String, ip_port: String) -> Peer {
        Peer {
            id: id,
            ip_port: ip_port,
            am_choking: true,
            am_interested: false,
            peer_choking: true,
            peer_interested: false,
        }
    }
}

struct TrackerRequest {
    info_hash: String,
    peer_id: String,
    port: usize, // port client is listening on, between 6881-6889
    uploaded: usize,
    downloaded: usize,
    left: usize,
    event: EventType, // TODO think about adding optional fields
}

enum EventType {
    Started,
    Stopped,
    Completed,
}

{'fraction_non_alphanumeric': 0.10294920808301475, 'fraction_numerical': 0.008192244675040962, 'mean_word_length': 2.078151260504202, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6388161', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1202, 'n_words': 348}