clamav

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClamAV

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

ClamAV is a client that allows scanning of content for malware.

func New

func New(clamIP, clamPort, portal string) (*ClamAV, error)

New creates a new ClamAV client that will try to connect to the ClamAV service listening on a TCP socket at the given address and port. Before returning the client, New verifies the connection to ClamAV.

func (*ClamAV) Ping

func (c *ClamAV) Ping() error

Ping checks the ClamAV daemon's state.

func (*ClamAV) PreferredPortal

func (c *ClamAV) PreferredPortal() string

PreferredPortal returns the portal ClamAV uses to download content.

func (*ClamAV) Scan

func (c *ClamAV) Scan(r io.Reader, abort chan bool) (infected bool, description string, err error)

Scan streams the content of the reader to ClamAV for malware scanning. It returns an `infected` flag, a description of the detected malware and an error.

func (c *ClamAV) ScanSkylink(skylink string, abort chan bool) (infected bool, description string, size, scannedSize uint64, err error)

ScanSkylink downloads the content of the given skylink and streams it to ClamAV for scanning. It returns an `infected` flag, a description of the detected malware and an error.

type ReaderCounter

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

ReaderCounter is a wrapper of io.Reader that counts how many bytes are read from it.

func NewReaderCounter

func NewReaderCounter(r io.Reader) *ReaderCounter

NewReaderCounter creates a new ReaderCounter instance.

func (*ReaderCounter) Read

func (rc *ReaderCounter) Read(p []byte) (n int, err error)

Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered. Even if Read returns n < len(p), it may use all of p as scratch space during the call. If some data is available but not len(p) bytes, Read conventionally returns what is available instead of waiting for more.

func (*ReaderCounter) ReadBytes

func (rc *ReaderCounter) ReadBytes() uint64

ReadBytes returns the number of bytes read from the reader so far.

Jump to

Keyboard shortcuts

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