clamclient 0.1.1

clamd client
Documentation
  • Coverage
  • 55.56%
    10 out of 18 items documented0 out of 13 items with examples
  • Size
  • Source code size: 11.86 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.21 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 17s Average build duration of successful builds.
  • all releases: 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • n01e0

clamd-client

example in src/main.rs

extern crate clamd_client;

use anyhow::Result;
use std::env;

fn main() -> Result<()> {
    let args = env::args().collect::<Vec<_>>();
    let mut clamd = clamd_client::Clamd::new()?;
    match args.len() {
        2 => {
            println!(
                "{}",
                match &args[1].to_lowercase()[..] {
                    "ping" => clamd.ping()?,
                    "version" => clamd.version()?,
                    "reload" => clamd.reload()?,
                    "shutdown" => {
                        clamd.shutdown()?;
                        String::from("Shutdown succeeded")
                    }
                    other => format!("Command not found: {other}"),
                }
            );
        }
        3 => {
            println!(
                "{}",
                match &args[1].to_lowercase()[..] {
                    "scan" => clamd.scan(&args[2])?,
                    "instream" => clamd.instream_scan(&args[2], None)?,
                    other => format!("Command not found: {other}"),
                }
            );
        }
        _ => {
            println!("Usage: {} [ping|version|reload|shutdown|scan|instream] [file]", args[0])
        }
    }

    Ok(())
}