precheck

package
v0.2.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 9 Imported by: 0

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