Expand description
§sproto
Rust client for the Synology Drive sync protocol, reverse-engineered from the official macOS client.
§Usage
use sproto::client::{Config, Credentials};
use sproto::TlsMode;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = sproto::Client::connect(
Config::builder()
.host("192.168.1.100")
.port(6690)
.tls(TlsMode::Insecure)
.credentials(Credentials::Password {
username: "admin".into(),
password: "secret".into(),
otp: None,
})
.build(),
).await?;
// List files
let nodes = client.list_dir(1, "/").await?;
for node in &nodes {
println!("{}", node.name);
}
// Download a file
client.download(&nodes[0].file_id, "output.bin".as_ref()).await?;
Ok(())
}You can also reuse an existing session from the Synology Drive desktop app:
use sproto::client::Credentials;
let creds = Credentials::Session {
session: "0c75d31bc30869b3...".into(),
restore_id: "b774a5c3782e9291...".into(),
};Refer to the documentation on docs.rs for detailed usage instructions, and check out the examples for working CLI tools:
cargo run --example ls -- --from-sqlite /
cargo run --example download_dir -- --from-sqlite /Music ./music
cargo run --example download -- --from-sqlite /Documents/report.pdf report.pdf§License
This project is licensed under the MIT License - see the LICENSE file for details.
Re-exports§
pub use client::Client;
Modules§
Enums§
Type Aliases§
- Result
- The result type used throughout the library.