engine

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package engine defines the interface between meles and malware scan engines such as clamd.

Index

Constants

This section is empty.

Variables

View Source
var ErrTooLarge = errors.New("stream too large for the engine")

ErrTooLarge is returned (wrapped) by Session.Scan when the engine refused a stream because of its size, e.g. above clamd's StreamMaxLength. The file counts as skipped, not as an error; the session must not be reused.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	// Open starts a session. Each concurrent worker uses its own session.
	Open(ctx context.Context) (Session, error)
	// Version reports the engine and signature database version. It is part
	// of the cache key, so results are rescanned after a signature update.
	Version(ctx context.Context) (Version, error)
}

Engine opens scan sessions.

type Session

type Session interface {
	// Scan returns the name of the matching signature, or "" if the stream
	// is clean.
	Scan(ctx context.Context, r io.Reader) (string, error)
	Close() error
}

Session scans one stream at a time. It is not safe for concurrent use.

type Version

type Version struct {
	Engine     string `json:"engine"`
	Signatures string `json:"signatures"`
	// Raw is the version string as reported by the engine.
	Raw string `json:"raw"`
}

Version identifies an engine and its signature database.

Directories

Path Synopsis
Package clamd talks to a ClamAV daemon over its socket protocol.
Package clamd talks to a ClamAV daemon over its socket protocol.
Package fake provides an in-process scan engine for tests.
Package fake provides an in-process scan engine for tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL