cfg

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IpsetMode    = "ipset"
	IptablesMode = "iptables"
	NftablesMode = "nftables"
	PfMode       = "pf"
)

Variables

This section is empty.

Functions

func MergedConfig

func MergedConfig(configPath string) ([]byte, error)

MergedConfig() returns the byte content of the patched configuration file (with .yaml.local).

Types

type BouncerConfig

type BouncerConfig struct {
	Mode            string        `yaml:"mode"` // ipset,iptables,tc
	PidDir          string        `yaml:"pid_dir"`
	UpdateFrequency string        `yaml:"update_frequency"`
	Daemon          bool          `yaml:"daemonize"`
	Logging         LoggingConfig `yaml:",inline"`
	DisableIPV6     bool          `yaml:"disable_ipv6"`
	DenyAction      string        `yaml:"deny_action"`
	DenyLog         bool          `yaml:"deny_log"`
	DenyLogPrefix   string        `yaml:"deny_log_prefix"`
	BlacklistsIpv4  string        `yaml:"blacklists_ipv4"`
	BlacklistsIpv6  string        `yaml:"blacklists_ipv6"`
	SetType         string        `yaml:"ipset_type"`
	SetSize         int           `yaml:"ipset_size"`

	// specific to iptables, following https://github.com/asians-cloud/cs-blackrules-bouncer/issues/19
	IptablesChains          []string `yaml:"iptables_chains"`
	SupportedDecisionsTypes []string `yaml:"supported_decisions_types"`
	// specific to nftables, following https://github.com/asians-cloud/cs-blackrules-bouncer/issues/74
	Nftables struct {
		Ipv4 nftablesFamilyConfig `yaml:"ipv4"`
		Ipv6 nftablesFamilyConfig `yaml:"ipv6"`
	} `yaml:"nftables"`
	NftablesHooks []string `yaml:"nftables_hooks"`
	PF            struct {
		AnchorName string `yaml:"anchor_name"`
		BatchSize  int    `yaml:"batch_size"`
	} `yaml:"pf"`
	PrometheusConfig PrometheusConfig `yaml:"prometheus"`
}

func NewConfig

func NewConfig(reader io.Reader) (*BouncerConfig, error)

type LoggingConfig

type LoggingConfig struct {
	LogMode      string     `yaml:"log_mode"`
	LogDir       string     `yaml:"log_dir"`
	LogLevel     *log.Level `yaml:"log_level"`
	CompressLogs *bool      `yaml:"compress_logs,omitempty"`
	LogMaxSize   int        `yaml:"log_max_size,omitempty"`
	LogMaxFiles  int        `yaml:"log_max_files,omitempty"`
	LogMaxAge    int        `yaml:"log_max_age,omitempty"`
}

func (*LoggingConfig) LoggerForFile

func (c *LoggingConfig) LoggerForFile(fileName string) (io.Writer, error)

type PrometheusConfig

type PrometheusConfig struct {
	Enabled       bool   `yaml:"enabled"`
	ListenAddress string `yaml:"listen_addr"`
	ListenPort    string `yaml:"listen_port"`
}

Jump to

Keyboard shortcuts

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