pub struct TorrentMetaV2 {
pub info_hashes: InfoHashes,
pub info_bytes: Option<Bytes>,
pub announce: Option<String>,
pub announce_list: Option<Vec<Vec<String>>>,
pub comment: Option<String>,
pub created_by: Option<String>,
pub creation_date: Option<i64>,
pub info: InfoDictV2,
pub piece_layers: BTreeMap<Id32, Vec<u8>>,
pub ssl_cert: Option<Vec<u8>>,
}Expand description
Parsed v2 .torrent file (BEP 52).
Fields§
§info_hashes: InfoHashesUnified info hashes (v2 SHA-256, optionally truncated v1 for compat).
info_bytes: Option<Bytes>Raw info dict bytes for BEP 9 metadata serving.
announce: Option<String>Primary announce URL.
announce_list: Option<Vec<Vec<String>>>Announce list (BEP 12).
comment: Option<String>Comment.
created_by: Option<String>Created by.
creation_date: Option<i64>Creation date (unix timestamp).
info: InfoDictV2v2 info dictionary.
piece_layers: BTreeMap<Id32, Vec<u8>>Piece layers: pieces_root → concatenated SHA-256 hashes.
Each entry maps a file’s Merkle root to the concatenated piece-level
hashes. Only present for files larger than piece_length.
ssl_cert: Option<Vec<u8>>PEM-encoded SSL CA certificate from the info dict, if present.
Implementations§
Source§impl TorrentMetaV2
impl TorrentMetaV2
Sourcepub fn validate_piece_layers(&self) -> Result<(), Error>
pub fn validate_piece_layers(&self) -> Result<(), Error>
Validate that piece layers match the file tree.
Each file larger than piece_length must have a corresponding piece layer
with the correct number of hashes.
§Errors
Returns an error if a file is missing its piece layer or has the wrong hash count.
Sourcepub fn file_piece_hashes(&self, pieces_root: &Id32) -> Option<Vec<Id32>>
pub fn file_piece_hashes(&self, pieces_root: &Id32) -> Option<Vec<Id32>>
Get piece hashes for a file by its Merkle root.
Trait Implementations§
Source§impl Clone for TorrentMetaV2
impl Clone for TorrentMetaV2
Source§fn clone(&self) -> TorrentMetaV2
fn clone(&self) -> TorrentMetaV2
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more