util

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Flags flags
View Source
var Logger *log_level.Logger

Functions

func GenHash

func GenHash(str ...string) string

func GetStatusCode added in v0.1.13

func GetStatusCode(err error) int

func InitLogger

func InitLogger(c LoggerConfig) (out *os.File, err error)

func ParseFlags

func ParseFlags()

Types

type BlacklistConfig added in v1.3.0

type BlacklistConfig struct {
	NetInterfaceList     []string `json:"net_interface_list" env_var:"BLACKLIST_NET_INTERFACE_LIST"`
	NetRangeList         []string `json:"net_range_list" env_var:"BLACKLIST_NET_RANGE_LIST"`
	AppSocketList        []string `json:"app_socket_list" env_var:"BLACKLIST_APP_SOCKET_LIST"`
	NetInterfaceListPath string   `json:"net_interface_list_path" env_var:"BLACKLIST_NET_INTERFACE_LIST_PATH"`
	NetRangeListPath     string   `json:"net_range_list_path" env_var:"BLACKLIST_NET_RANGE_LIST_PATH"`
}

type Config

type Config struct {
	Logger           LoggerConfig    `json:"logger" env_var:"LOGGER_CONFIG"`
	Socket           SocketConfig    `json:"socket" env_var:"SOCKET_CONFIG"`
	Blacklist        BlacklistConfig `json:"blacklist" env_var:"BLACKLIST_CONFIG"`
	SerialDevicePath string          `json:"serial_device_path" env_var:"SERIAL_DEVICE_PATH"`
	ApplicationsPath string          `json:"applications_path" env_var:"APPLICATIONS_PATH"`
	CoreID           string          `json:"core_id" env_var:"CORE_ID"`
}

func NewConfig

func NewConfig(path string) (*Config, error)

type LoggerConfig added in v0.4.3

type LoggerConfig struct {
	Level        level.Level `json:"level" env_var:"LOGGER_LEVEL"`
	Utc          bool        `json:"utc" env_var:"LOGGER_UTC"`
	Path         string      `json:"path" env_var:"LOGGER_PATH"`
	FileName     string      `json:"file_name" env_var:"LOGGER_FILE_NAME"`
	Terminal     bool        `json:"terminal" env_var:"LOGGER_TERMINAL"`
	Microseconds bool        `json:"microseconds" env_var:"LOGGER_MICROSECONDS"`
	Prefix       string      `json:"prefix" env_var:"LOGGER_PREFIX"`
}

type SocketConfig

type SocketConfig struct {
	Path     string      `json:"path" env_var:"SOCKET_PATH"`
	GroupID  int         `json:"group_id" env_var:"SOCKET_GROUP_ID"`
	FileMode fs.FileMode `json:"file_mode" env_var:"SOCKET_FILE_MODE"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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