mod sharry; use log::{error, info}; use sharry::{Alias, File, NewShareRequest, Share}; use std::time::Duration; use ureq::Agent; fn main() { env_logger::init(); let agent: Agent = Agent::config_builder() .timeout_global(Some(Duration::from_secs(5))) .build() .into(); let alias = Alias::new( "sharry.yavook.de".into(), "G7RYoWME1W7-pcgipemJcr8-39FcMd92gBu-RgufeHc51z6", ); let share = NewShareRequest::new(Some("foo"), "", 10); let share = Share::create(&agent, &alias, share).unwrap(); info!("share: {share:?}"); let file = File::new("/lib/x86_64-linux-gnu/liblldb-14.so.1") .unwrap() .create(&agent, &share) .unwrap(); info!("file: {file:?}"); for chunk in file.chunked(10 * 1024 * 1024) { println!("chunk len: {}", chunk.bytes.len()); file.upload_chunk(&agent, &alias, &chunk) .inspect_err(|e| error!("error: {e}")) .unwrap(); } share.notify(&agent).unwrap(); }