[−][src]Crate arrsync
A tokio-based, rust only, self baked, partial rsync wire protocol implementation for retrieving files from rsyncd servers.
Quick example:
// Print all the Manifest files for gentoo ebuilds #[tokio::main] async fn main() -> anyhow::Result<()> { let url = url::Url::parse("rsync://rsync.de.gentoo.org/gentoo-portage/")?; let (mut client, files) = arrsync::RsyncClient::connect(&url).await?; for file in files.into_iter() { if !file.is_file() { continue; } if !file.path.ends_with("/Manifest".as_bytes()) { continue; } async fn get_and_print( file: arrsync::File, client: arrsync::RsyncClient ) -> anyhow::Result<()> { use tokio::io::AsyncReadExt; let mut content = vec![]; client.get(&file).await?.read_to_end(&mut content).await?; // "Race" to finish. Ignored for simplicity reasons. print!("{}", String::from_utf8(content)?); Ok(()) } tokio::spawn(get_and_print(file, client.clone())); } client.close().await?; Ok(()) }
Beware that rsync is, of course, unencrypted.
Structs
File | Information about a file on the rsync server |
RsyncClient | The main client struct |