common

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RejectActionProxy    = "proxy"
	RejectActionRedirect = "redirect"
	RejectActionDrop     = "drop"
	RejectActionNone     = "none"
)
View Source
const (
	FilterActionAccept = "accept"
	FilterActionReject = "reject"
)

Variables

This section is empty.

Functions

func FormatStringSlice added in v1.1.0

func FormatStringSlice(s []string) string

func FormatStringerSlice added in v1.1.0

func FormatStringerSlice[T fmt.Stringer](s []T) string

Types

type Config

type Config struct {
	Rules   []RuleConfig  `mapstructure:"rules"`
	Proxies []ProxyConfig `mapstructure:"proxies"`
	Globals Globals       `mapstructure:"globals"`
}

type Filter added in v1.3.0

type Filter struct {
	Rule   string `mapstructure:"rule"`
	Action string `mapstructure:"action"`
}

type Globals added in v1.3.0

type Globals struct {
	IPApiComKey string `mapstructure:"ip-apicom_key"`
	IPApiCoKey  string `mapstructure:"ipapico_key"`
}

type ProxyConfig

type ProxyConfig struct {
	Name         string        `mapstructure:"name"`
	Type         string        `mapstructure:"type"`
	ListenAddr   string        `mapstructure:"listen"`
	TargetAddr   string        `mapstructure:"target"`
	Timeout      time.Duration `mapstructure:"timeout"`
	TLS          []TLS         `mapstructure:"tls"`
	RuleSettings RuleSettings  `mapstructure:"filter_settings"`
	Filters      []Filter      `mapstructure:"filters"`
}

type RuleConfig added in v1.3.0

type RuleConfig struct {
	Name   string         `mapstructure:"name"`
	Type   string         `mapstructure:"type"`
	Params map[string]any `mapstructure:"params"`
}

type RuleSettings added in v1.3.0

type RuleSettings struct {
	RejectAction string `mapstructure:"reject_action"`
	RejectURL    string `mapstructure:"reject_url"`

	NoRejectThreshold uint `mapstructure:"noreject_threshold"`
	RejectThreshold   uint `mapstructure:"reject_threshold"`
}

type TLS

type TLS struct {
	Cert   string `mapstructure:"cert"`
	Key    string `mapstructure:"key"`
	Domain string `mapstructure:"domain"`
}

Jump to

Keyboard shortcuts

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