torrentdht 0.1.1

DHT discovery with mTLS handshake handoff; optional BitTorrent when the host opts in
Documentation
//! BEP 6 — Fast extension (Suggest, Have All/None, Reject Request, Allowed Fast).

pub const FAST_RESERVED_BIT: u8 = 0x04;

pub fn supports_fast(reserved: &[u8; 8]) -> bool {
    reserved[7] & FAST_RESERVED_BIT != 0
}

pub fn enable_fast(reserved: &mut [u8; 8]) {
    reserved[7] |= FAST_RESERVED_BIT;
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn fast_bit_roundtrip() {
        let mut reserved = [0u8; 8];
        enable_fast(&mut reserved);
        assert!(supports_fast(&reserved));
    }
}