Documentation
¶
Overview ¶
Package clamd is a client for ClamAV daemon over TCP or UNIX socket.
Index ¶
- Variables
- type Clamd
- func (c *Clamd) Ping(ctx context.Context) (bool, error)
- func (c *Clamd) Reload(ctx context.Context) (bool, error)
- func (c *Clamd) Scan(ctx context.Context, src string) (bool, error)
- func (c *Clamd) ScanAll(ctx context.Context, src string) (bool, error)
- func (c *Clamd) ScanStream(ctx context.Context, r io.Reader) (bool, error)
- func (c *Clamd) Shutdown(ctx context.Context) (bool, error)
- func (c *Clamd) Stats(ctx context.Context) (*Stats, error)
- func (c *Clamd) Version(ctx context.Context) (string, error)
- type MemStat
- type Option
- type Queue
- type Stats
- type Thread
Constants ¶
This section is empty.
Variables ¶
var ( ErrDial = errors.New("error while connecting to clamd") ErrCommandCall = errors.New("error while calling clamd") ErrCommandRead = errors.New("error while reading response from clamd") ErrEmptySrc = errors.New("scan source is empty") ErrInvalidResponse = errors.New("invalid response from clamd") ErrNoSuchFileOrDir = errors.New("clamd can't find file or directory") ErrPermissionDenied = errors.New("clamd can't open file or dir, permission denied") ErrSreamLimitExceeded = errors.New("clamd's INSTREAM size limit exceeded") ErrUnknown = errors.New("unknown error") ErrEICARFound = errors.New("Win.Test.EICAR_HDB-1 FOUND") )
Errors
Functions ¶
This section is empty.
Types ¶
type Clamd ¶
type Clamd struct {
// contains filtered or unexported fields
}
Clamd is a client for ClamAV's daemon clamd.
func NewClamd ¶
NewClamd returns a Clamd client with default options.
Default connection is a UNIX socket on /var/run/clamav/clamd.ctl with 30 second timeout. Defaults can be changed by passing in Option functions.
func (*Clamd) Scan ¶
Scan a file or a directory (recursively) with archive support enabled (if not disabled in clamd.conf). A full path is required.
func (*Clamd) ScanAll ¶
ScanAll Scan file or directory (recursively) with archive support enabled and don't stop the scanning when a virus is found.
func (*Clamd) ScanStream ¶
ScanStream Scan a stream of data.This avoids the overhead of establishing new TCP connections and problems with NAT.
Note: do not exceed StreamMaxLength as defined in clamd.conf, otherwise clamd will reply with INSTREAM size limit exceeded and close the connection. (default is 25M)
type Option ¶
type Option func(*Clamd)
Option sets an option to Clamd.
func WithDefaultTCP ¶
func WithDefaultTCP() Option
WithDefaultTCP sets up the client to use the default TCP connection on 127.0.0.1:3310
func WithTimeout ¶
WithTimeout sets a timeout on the connection.