clamd

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MPL-2.0 Imports: 13 Imported by: 4

README

clamd

Golang Clamd Client

Ci codecov Go Report Card Go Reference MPLv2 License

Description

clamd is a Golang library and cmdline tool that implements the Clamd client protocol used by ClamAV.

Requirements

  • Golang 1.10.x or higher

Getting started

Clamd client

The clamd client can be installed as follows

$ go get github.com/baruwa-enterprise/clamd/cmd/clamdscan

Or by cloning the repo and then running

$ make build
$ ./bin/clamdscan
Clamd library

To install the library

go get github.com/baruwa-enterprise/clamd

You can then import it in your code

import "github.com/baruwa-enterprise/clamd"
Testing

make test

License

MPL-2.0

Documentation

Overview

Package clamd Golang Clamd client Clamd - Golang clamd client

Index

Constants

View Source
const (

	// ChunkSize the size for chunking INSTREAM files
	ChunkSize = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client represents a Clamd client.

func NewClient

func NewClient(network, address string) (c *Client, err error)

NewClient returns a new Clamd client.

func (*Client) ContScan

func (c *Client) ContScan(ctx context.Context, p string) (r []*Response, err error)

ContScan a file or directory

func (*Client) Fildes

func (c *Client) Fildes(ctx context.Context, p string) (r []*Response, err error)

Fildes scan a FD

func (*Client) InStream

func (c *Client) InStream(ctx context.Context, p string) (r []*Response, err error)

InStream scan a stream

func (*Client) MultiScan

func (c *Client) MultiScan(ctx context.Context, p string) (r []*Response, err error)

MultiScan a file or directory

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) (b bool, err error)

Ping sends a ping to the server

func (*Client) Reload

func (c *Client) Reload(ctx context.Context) (b bool, err error)

Reload the server

func (*Client) Scan

func (c *Client) Scan(ctx context.Context, p string) (r []*Response, err error)

Scan a file or directory

func (*Client) ScanReader

func (c *Client) ScanReader(ctx context.Context, i io.Reader) (r []*Response, err error)

ScanReader scans an io.reader

func (*Client) SetCmdTimeout

func (c *Client) SetCmdTimeout(t time.Duration)

SetCmdTimeout sets the cmd timeout

func (*Client) SetConnRetries

func (c *Client) SetConnRetries(s int)

SetConnRetries sets the number of times connection is retried

func (*Client) SetConnSleep

func (c *Client) SetConnSleep(s time.Duration)

SetConnSleep sets the connection retry sleep duration in seconds

func (*Client) SetConnTimeout

func (c *Client) SetConnTimeout(t time.Duration)

SetConnTimeout sets the connection timeout

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context) (err error)

Shutdown stops the server

func (*Client) Stats

func (c *Client) Stats(ctx context.Context) (s string, err error)

Stats returns server stats

func (*Client) Version

func (c *Client) Version(ctx context.Context) (v string, err error)

Version returns the server version

func (*Client) VersionCmds

func (c *Client) VersionCmds(ctx context.Context) (r []string, err error)

VersionCmds returns the supported cmds

type Response

type Response struct {
	Filename  string
	Signature string
	Status    string
	Raw       string
}

Response is the response from the server

Directories

Path Synopsis
cmd
clamdscan
Package clamd Golang Clamd client Clamd - Golang clamd client Package clamd Golang Clamd client Clamd - Golang clamd client
Package clamd Golang Clamd client Clamd - Golang clamd client Package clamd Golang Clamd client Clamd - Golang clamd client
Package protocol Golang Clamd client Clamd - Golang clamd client
Package protocol Golang Clamd client Clamd - Golang clamd client

Jump to

Keyboard shortcuts

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