extern crate magnolia; use std::env; use std::fs::File; use std::io::{self, Read}; use std::str; use magnolia::bencode::*; use magnolia::metainfo::Metainfo; use magnolia::torrent::Torrent; use magnolia::tracker::http; fn load_file(path: &str) -> io::Result<()> { let mut buf = Vec::new(); let mut f = File::open(path)?; f.read_to_end(&mut buf)?; let obj = decode(&buf).unwrap(); let meta = Metainfo::from_bencode(obj).unwrap(); let t = Torrent { metainfo: meta, uploaded: 0, downloaded: 0, left: 0, }; let resp = http::get_peers([1u8; 20], 55555, &t).unwrap(); print!("{:?}", resp); Ok(()) } fn main() { let path = env::args().nth(1).expect("need path to .torrent file"); load_file(&path).unwrap(); }