pub struct AnnounceResponse<'a> { /* private fields */ }Expand description
One complete response dictionary, with borrowed peers/strings. A tracker failure is a valid response, not a codec error, and exposes no candidates.
Implementations§
Source§impl<'a> AnnounceResponse<'a>
impl<'a> AnnounceResponse<'a>
Sourcepub fn parse(
input: &'a [u8],
limits: Limits,
max_peers: usize,
) -> Result<Self, Error>
pub fn parse( input: &'a [u8], limits: Limits, max_peers: usize, ) -> Result<Self, Error>
The peer cap combines both families and counts every entry in the selected dictionary list (even malformed entries), duplicates and zero-port compact peers. Last-wins duplicate fields use bencode policy; the bencode budgets still cover overwritten values and ignored fields. Partial compact tails remain available through each view’s remainder().
Missing/wrong-typed peer fields are empty. Missing/invalid numeric hints are None, not defaults or scheduling instructions. This permits stopped replies and inspection of incomplete responses; it does not certify a conforming successful announce. Failure reason must be a byte string; it takes precedence over peer semantics, but the entire body is still decoded under all bencode budgets, including ignored fields.
pub fn document(&self) -> &Node<'a>
pub fn failure_reason(&self) -> Option<&'a [u8]>
pub fn warning_message(&self) -> Option<&'a [u8]>
pub fn tracker_id(&self) -> Option<&'a [u8]>
Sourcepub fn interval_secs(&self) -> Option<u64>
pub fn interval_secs(&self) -> Option<u64>
Checked, untrusted seconds, including zero; no runtime defaults/clamps.
pub fn min_interval_secs(&self) -> Option<u64>
pub fn complete(&self) -> Option<u64>
pub fn incomplete(&self) -> Option<u64>
pub fn downloaded(&self) -> Option<u64>
pub fn peers_v4(&self) -> PeersV4<'a>
pub fn peers_v6(&self) -> PeersV6<'a>
Sourcepub fn dictionary_peers(&self) -> impl Iterator<Item = DictionaryPeer<'a>> + '_
pub fn dictionary_peers(&self) -> impl Iterator<Item = DictionaryPeer<'a>> + '_
Entries with a nonempty byte-string ip and a u16 port are yielded in original order; malformed entries are skipped, but still count against max_peers. Port zero and arbitrary host bytes are deliberately retained. Failure responses yield no peers, even if they contain peer fields.