Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
SweepAndScan sweeps the DB for new skylinks, locks them, scans them, and updates their records in the DB.