config

package
v0.0.0-...-44e10d2 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MulanPSL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Server  ServerConfig  `mapstructure:"server"`
	Log     LogConfig     `mapstructure:"log"`
	Routine RoutineConfig `mapstructure:"routine"`
}
var Config *AppConfig

func NewAppConfig

func NewAppConfig() *AppConfig

type LogConfig

type LogConfig struct {
	ErrorLog string `mapstructure:"error_log"`
	InfoLog  string `mapstructure:"info_log"`
}

type RoutineConfig

type RoutineConfig struct {
	MonitorRoutine bool          `mapstructure:"monitor_routine"`
	CheckInterval  time.Duration `mapstructure:"check_interval"`
}

type ServerConfig

type ServerConfig struct {
	DeviceName string `mapstructure:"device_name"`
	SnapLen    int32  `mapstructure:"snap_len"`
	Promisc    bool
	Timeout    time.Duration
	BpfFilter  string `mapstructure:"bpf_filter"`
}

viper默认情况下会尝试匹配配置文件中的字段名与结构体字段名, 不区分大小写,但需要确保字段名在结构体中是可导出的

Jump to

Keyboard shortcuts

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