precheck

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortItems

func SortItems(items []Item)

SortItems sorts result items by severity/check/rule_id for stable output.

Types

type Error

type Error struct {
	Result Result
}

Error wraps a failed precheck result.

func (*Error) Error

func (e *Error) Error() string

type Item

type Item struct {
	Severity Severity `json:"severity"`
	Check    string   `json:"check"`
	RuleID   string   `json:"rule_id,omitempty"`
	Message  string   `json:"message"`
}

Item is one precheck finding.

type Options

type Options struct {
	// CheckBind tests whether desired listen endpoints can be bound. Endpoints
	// already owned by the same running rule are skipped to avoid false reload
	// failures.
	CheckBind bool

	// CheckTargetResolve tests target address resolution for forwarding rules.
	CheckTargetResolve bool
}

Options controls precheck behavior.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns production-safe precheck defaults.

type Result

type Result struct {
	OK            bool   `json:"ok"`
	ErrorCount    int    `json:"error_count"`
	WarningCount  int    `json:"warning_count"`
	CheckedRules  int    `json:"checked_rules"`
	CheckedTimeMS int64  `json:"checked_time_ms"`
	Items         []Item `json:"items"`
}

Result is the complete rule/config precheck result.

func CheckConfig

func CheckConfig(cfg config.File, running []engine.Rule, opts Options) Result

CheckConfig validates a loaded config against currently running rules.

type Severity

type Severity string
const (
	SeverityError   Severity = "error"
	SeverityWarning Severity = "warning"
)

Jump to

Keyboard shortcuts

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