pub struct ClamdClient { /* private fields */ }
Expand description

Asynchronous, tokio based client for clamd. Use ClamdClientBuilder to build. At the moment, this will always open a new TCP connection for each command executed. There are plans to also include an option to reuse / keep alive connections but that is a TODO.

For more information about the various commands please also consult the man pages for clamd (man clamd).

Example

let address = "127.0.0.1:3310".parse::<SocketAddr>()?;
let mut clamd_client = ClamdClientBuilder::tcp_socket(&address).build();
clamd_client.ping().await?;

Implementations

Ping clamd. If it responds normally (with PONG) this function returns Ok(()), otherwise returns with error.

Get clamd version string.

Reload clamd.

Get clamd stats.

Shutdown clamd. Careful: There is no way to start clamd again from this library.

Upload bytes to check it for viruses. This will chunk the reader with a chunk size defined in the ClamdClientBuilder. Only if clamd resonds with stream: OK (and thus clamd found the bytes to not include virus signatures) this function will return Ok(()). In all other cases returns an error.

Errors

If the scan was sucessful but seems to have found a virus signature this returns ClamdError::ScanError with the scan result. See ClamdError for more information.

Convienence method to scan a bytes slice. Wraps ClamdClient::scan_reader, so see there for more information.

Convienence method to directly scan a file under the given path. This will read the file and stream it to clamd. Wraps ClamdClient::scan_reader, so see there for more information.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more