scanner

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: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BlockerIP is the IP of the blocker service.
	// Set according to the BLOCKER_IP env var.
	BlockerIP string
	// BlockerPort is the port of the blocker service.
	// Set according to the BLOCKER_PORT env var.
	BlockerPort string
)

Functions

This section is empty.

Types

type Scanner

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

Scanner provides a convenient interface for working with ClamAV

func New

func New(ctx context.Context, db *database.DB, clam *clamav.ClamAV, logger *logrus.Logger) (*Scanner, error)

New returns a new Scanner with the given parameters.

func (Scanner) Start

func (s Scanner) Start()

Start launches a background task that periodically scans the database for new skylink records and sends them for scanning.

func (Scanner) StartUnlocker

func (s Scanner) StartUnlocker()

StartUnlocker launches a background thread that periodically scans the database and resets the state of potentially stuck scans. If a scan has been initiated too long ago it will put it back in "new" state, so it can be retried.

func (Scanner) SweepAndBlock

func (s Scanner) SweepAndBlock() (int, error)

SweepAndBlock scans the database for malicious skylinks that haven't been reported to blocker yet and reports them. It doesn't lock the records because it isn't needed.

func (Scanner) SweepAndScan

func (s Scanner) SweepAndScan(abort chan bool) error

SweepAndScan sweeps the DB for new skylinks, locks them, scans them, and updates their records in the DB.

Jump to

Keyboard shortcuts

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