Crates.io | clamd-client |
lib.rs | clamd-client |
version | 0.1.2 |
source | src |
created_at | 2022-11-24 10:29:10.90288 |
updated_at | 2022-11-24 14:34:42.217127 |
description | Rust async tokio client for clamd. Works with a tcp socket or with the unix socket. At the moment it will open a new socket for each command. Work in progress. |
homepage | https://github.com/LevitatingOrange/clamd-client |
repository | https://github.com/LevitatingOrange/clamd-client |
max_upload_size | |
id | 722141 |
size | 67,927 |
Rust async tokio client for clamd. Works with a tcp socket or with the unix socket. At the moment it will open a new socket for each command. Work in progress.
See also examples/simple.rs
.
There should be a running clamd instance on your machine (see Notes).
#[tokio::main]
async fn main() -> Result<()> {
let address = "127.0.0.1:3310";
let mut clamd_client = ClamdClientBuilder::tcp_socket(address).build();
let eicar_bytes = reqwest::get("https://secure.eicar.org/eicarcom2.zip")
.await?
.bytes()
.await?;
let err = clamd_client.scan_bytes(&eicar_bytes).await.unwrap_err();
let msg = err.scan_error().unwrap();
println!("Eicar scan returned that its a virus: {}", msg);
Ok(())
}
To run cargo test
or the examples you have to have a running clamd instance on your machine. Easiest would be to use docker:
docker run -p 3310:3310 -v /run/clamav/:/run/clamav/ clamav/clamav:unstable
cargo test
<String, str>
type bounds.