engine

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package engine orchestrates a scan: it selects targets, runs the probes for every endpoint (repeated, with majority voting), measures throttling, classifies the results and streams progress events.

Index

Constants

View Source
const (
	PhasePrecheck = "precheck"
	PhaseBaseline = "baseline"
	PhaseTargets  = "targets"
	PhaseDNS      = "dns"
	PhaseWL       = "whitelist"
)

Phases reported through EventPhase.

Variables

View Source
var ErrNoWhitelistConfig = errors.New("whitelist.yaml is not loaded")

ErrNoWhitelistConfig is returned when whitelist.yaml is missing.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	Env     *probe.Env
	Catalog *catalog.Catalog
	Opt     Options
	// contains filtered or unexported fields
}

Engine runs scans.

func New

func New(env *probe.Env, cat *catalog.Catalog, opt Options) *Engine

New prepares an engine.

func (*Engine) DNSReport

func (e *Engine) DNSReport(ctx context.Context) *model.DNSReport

DNSReport runs the resolver matrix and the interception probes.

func (*Engine) NewReport

func (e *Engine) NewReport(netinfo model.NetworkInfo) *model.Report

NewReport creates an empty report with tool metadata filled in.

func (*Engine) Scan

func (e *Engine) Scan(ctx context.Context, sel catalog.Selection, netinfo model.NetworkInfo, events chan<- Event) (*model.Report, error)

Scan measures the selected targets. Events (optional) receive progress; the channel is not closed by Scan.

func (*Engine) Whitelist

func (e *Engine) Whitelist(ctx context.Context, events chan<- Event) (*model.WhitelistResult, error)

Whitelist checks whether only domestic (allow-listed) services are reachable.

type Event

type Event struct {
	Kind   EventKind
	Phase  string
	Done   int
	Total  int
	Target *model.TargetResult
	Report *model.Report
}

Event is a progress notification.

type EventKind

type EventKind int

EventKind identifies progress events.

const (
	EventStarted EventKind = iota
	EventPhase
	EventTarget
	EventFinished
)

Event kinds.

type Options

type Options struct {
	Repeats       int
	Concurrency   int
	QUIC          bool
	DNSChecks     bool
	Precheck      bool
	Jitter        time.Duration
	EndpointBody  int64 // bytes read from each endpoint's page
	ThrottleLimit int64 // bytes read from throttle_url
	Version       string
	Commit        string
	Demo          bool
}

Options tune a scan.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns production defaults.

Jump to

Keyboard shortcuts

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