xodbox

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// IgnoreCIDRsKey is a comma-separated list of source IPs/CIDRs to drop.
	IgnoreCIDRsKey = "ignore_cidrs"
	// IgnorePatternKey is a regex matched against the event FilterString
	// ("HANDLER ACTION DETAIL from IP[,IP...]"), so it can select on handler,
	// method, path, or source IP — e.g. "^HTTPX GET /old-test-callback".
	IgnorePatternKey = "ignore_pattern"
)

Config keys (under `defaults:`) for the global ignore/drop list. An event matching either rule is discarded before it is persisted or dispatched to notifiers — no DB row, no notification, no log line. Use this to silence a known-noisy source (e.g. a leftover beacon from an old test that keeps calling back every second) without muting the rest of your traffic.

View Source
const ConfigFileName = "xodbox.yaml"
View Source
const DefaultNotifyFilter = "^/l"

Variables

View Source
var ConfigFilePath string

ConfigFilePath is the path to the active config file, set by LoadConfig.

View Source
var EmbeddedConfig embed.FS

Functions

func EmbeddedConfigReadFile added in v0.0.7

func EmbeddedConfigReadFile(name string) ([]byte, error)

func NewConfigOps added in v0.1.3

func NewConfigOps() types.ConfigOps

NewConfigOps returns a types.ConfigOps backed by the package-level config state.

func Open

func Open(name string) (fs.File, error)

func ReadDir

func ReadDir(name string) ([]fs.DirEntry, error)

func ValidHandlerNames added in v0.1.3

func ValidHandlerNames() []string

func ValidNotifierNames added in v0.1.3

func ValidNotifierNames() []string

func ValidWorkerNames added in v0.1.3

func ValidWorkerNames() []string

func ValidateConfigFile added in v0.1.3

func ValidateConfigFile(cf *ConfigFile) []string

ValidateConfigFile checks that every handler, notifier, and worker entry references a registered name. It returns a slice of human-readable errors (empty when valid).

func WriteConfigFile added in v0.1.3

func WriteConfigFile(p string, cf *ConfigFile) error

WriteConfigFile marshals cf to YAML and writes it atomically to path.

Types

type App

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

func NewApp

func NewApp(config *Config) *App

func (*App) GetTemplateData

func (x *App) GetTemplateData() map[string]string

func (*App) RegisterNotificationHandler

func (x *App) RegisterNotificationHandler(n types.Notifier)

func (*App) Reload added in v0.1.3

func (x *App) Reload() error

Reload stops all running handlers/workers, reloads config from disk, and starts the new handlers/workers. The event loop and persister keep running across the reload. Returns an error if the new config is invalid; in that case the old handlers are already stopped — a second Reload with a fixed config will recover.

func (*App) Run

func (x *App) Run()

func (*App) Shutdown added in v0.0.22

func (x *App) Shutdown()

Shutdown stops every registered handler and unblocks Run. Idempotent — multiple callers see only the first stop fire.

type Config

type Config struct {
	TemplateData map[string]string `yaml:"template_data"`
	Handlers     []types.Handler
	Notifiers    []types.Notifier
	Workers      []types.Worker
}

Config used by App for bootstrapping

func LoadConfig

func LoadConfig(configFile string) *Config

LoadConfig creates a Config from the yaml contents in configFile

func ToConfig added in v0.1.3

func ToConfig(conf *ConfigFile) *Config

ToConfig creates a Config struct based on the ConfigFile

type ConfigFile

type ConfigFile = types.ConfigFile

ConfigFile is an alias for types.ConfigFile kept for backward compatibility within this package and its tests.

func ConfigFromFile added in v0.1.3

func ConfigFromFile(configFile string) (*ConfigFile, error)

ConfigFromFile returns ConfigFile loaded from a file.

Jump to

Keyboard shortcuts

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