config

package
v0.0.0-...-e806ef4 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Web    ServerConfig `mapstructure:"web" validate:"required"`
	Log    Log          `mapstructure:"log" validate:"required"`
	Engine Engine       `mapstructure:"engine" validate:"required,oneof=iptables nftables"`
}

func GetConfig

func GetConfig(logger *slog.Logger) (*Config, error)

type Engine

type Engine string
const (
	Iptables Engine = "iptables"
	Nftables Engine = "nftables"
)

type Log

type Log struct {
	Level LogLevel `mapstructure:"level" validate:"required,oneof=debug info warn error"`
}

type LogFormat

type LogFormat string
const (
	HumanReadable LogFormat = "human-readable"
	Json          LogFormat = "json"
)

type LogLevel

type LogLevel string
const (
	Debug LogLevel = "debug"
	Info  LogLevel = "info"
	Warn  LogLevel = "warn"
	Error LogLevel = "error"
)

type ServerConfig

type ServerConfig struct {
	ListenPort int    `mapstructure:"port" validate:"required"`
	Host       string `mapstructure:"host" validate:"required"`
}

Jump to

Keyboard shortcuts

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