engine

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package engine provides the Leakwatch scan engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Concurrency   int
	Detectors     []detector.Detector
	EnableEntropy bool
	// EntropyThreshold is display-only at the engine level. When EnableEntropy
	// is set, the engine computes Shannon entropy purely to populate
	// Finding.Entropy for reporting (see rawToFinding); it does NOT gate or drop
	// findings whose entropy falls below this value. Threshold-based gating
	// currently applies only to custom rules (handled inside their detector);
	// engine-wide entropy gating is planned and tracked separately in the docs/
	// ROADMAP. The value is defaulted to defaultEntropyThreshold in New.
	EntropyThreshold float64
	ShowRaw          bool
	Clock            func() time.Time // Optional; defaults to time.Now
	VerifierConfig   verifier.Config
	Verifiers        []verifier.Verifier
	OnlyVerified     bool             // If true, only return verified active findings
	MinSeverity      finding.Severity // Minimum severity to include in results
}

Config holds the scan engine configuration.

type Engine

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

Engine is the scan engine that orchestrates detection and verification.

func New

func New(cfg Config) *Engine

New creates a new scan engine. The Aho-Corasick automaton is compiled from detector keywords.

func (*Engine) Scan

func (e *Engine) Scan(ctx context.Context, src source.Source) (*ScanResult, error)

Scan scans the given source and returns results.

type ScanResult

type ScanResult struct {
	Findings      []finding.Finding
	ScannedChunks int
	Duration      time.Duration
	Interrupted   bool
}

ScanResult represents the outcome of a scan.

Jump to

Keyboard shortcuts

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