policy

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Challenge

type Challenge struct {
	Conditions []string `yaml:"conditions"`
	Mode       string   `yaml:"mode"`
	Asset      *string  `yaml:"asset,omitempty"`
	Url        *string  `yaml:"url,omitempty"`

	Parameters map[string]string `json:"parameters,omitempty"`
	Runtime    struct {
		Mode        string  `yaml:"mode,omitempty"`
		Asset       string  `yaml:"asset,omitempty"`
		Probability float64 `yaml:"probability,omitempty"`
	} `yaml:"runtime"`
}

type Network

type Network struct {
	Url  *string `yaml:"url,omitempty"`
	File *string `yaml:"file,omitempty"`

	JqPath *string `yaml:"jq-path,omitempty"`
	Regex  *string `yaml:"regex,omitempty"`

	Prefixes []string `yaml:"prefixes,omitempty"`
}

func (Network) FetchPrefixes

func (n Network) FetchPrefixes(c *http.Client) (output []net.IPNet, err error)

type Policy

type Policy struct {

	// Networks map of networks and prefixes to be loaded
	Networks map[string][]Network `yaml:"networks"`

	Conditions map[string][]string `yaml:"conditions"`

	Challenges map[string]Challenge `yaml:"challenges"`

	Rules []Rule `yaml:"rules"`

	// Backends
	// Deprecated
	Backends map[string]string `json:"backends"`
}

type Rule

type Rule struct {
	Name       string   `yaml:"name"`
	Host       *string  `yaml:"host"`
	Conditions []string `yaml:"conditions"`

	Action string `yaml:"action"`

	Challenges []string `yaml:"challenges"`
}

type RuleAction

type RuleAction string
const (
	RuleActionPASS      RuleAction = "PASS"
	RuleActionDENY      RuleAction = "DENY"
	RuleActionBLOCK     RuleAction = "BLOCK"
	RuleActionCHALLENGE RuleAction = "CHALLENGE"
	RuleActionCHECK     RuleAction = "CHECK"
	RuleActionPOISON    RuleAction = "POISON"
)

Jump to

Keyboard shortcuts

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