clamav

Types

pub type ClamError {
  ScanError(error: String)
  CannotParseResponse(ClamResponseParsingError)
  ConnectionError(error: mug.Error)
}

Constructors

  • ScanError(error: String)
  • CannotParseResponse(ClamResponseParsingError)
  • ConnectionError(error: mug.Error)
pub type ClamResponseParsingError {
  UnexpectedResponse(raw_response: String)
  InvalidBinaryData
}

Constructors

  • UnexpectedResponse(raw_response: String)
  • InvalidBinaryData
pub type ClamScanResult {
  Clean
  VirusDetected(infected_files: List(InfectedFile))
}

Constructors

  • Clean
  • VirusDetected(infected_files: List(InfectedFile))
pub type ClamVersionResponse {
  ClamVersionResponse(version: String, database_version: String)
}

Constructors

  • ClamVersionResponse(version: String, database_version: String)
pub type InfectedFile {
  InfectedFile(file_name: String, virus_name: String)
}

Constructors

  • InfectedFile(file_name: String, virus_name: String)

Functions

pub fn connection_timeout(
  client: ClamAvClientOptions,
  connection_timeout: Int,
) -> ClamAvClientOptions

Configures the total connection timeout for the client to use. Defaults to 10s

pub fn instream(
  options: ClamAvClientOptions,
  file_content: BitArray,
) -> Result(ClamScanResult, ClamError)

Scan a file in memory

pub fn logger(
  client: ClamAvClientOptions,
  logger: Logger,
) -> ClamAvClientOptions

Configures a logger for the client to use. Defaults to a nil logger

pub fn new(host: String) -> ClamAvClientOptions

Creates a new instance of the client options given a host, with default values for the rest

pub fn ping(
  options: ClamAvClientOptions,
) -> Result(Nil, ClamError)

Send a PING command to the ClamAV server

pub fn port(
  client: ClamAvClientOptions,
  port: Int,
) -> ClamAvClientOptions

Configures the port for the client to use. Defaults to 3310

pub fn reply_timeout(
  client: ClamAvClientOptions,
  reply_timeout: Int,
) -> ClamAvClientOptions

Configures the timeout for awaiting a reply from the clam server. Defaults to 10s

pub fn stats(
  options: ClamAvClientOptions,
) -> Result(String, ClamError)
pub fn version(
  options: ClamAvClientOptions,
) -> Result(ClamVersionResponse, ClamError)
Search Document