config

package
v0.0.0-...-aec2e1a Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const SQL_CLASS = 0x01
View Source
const SQL_TYPE_MYSQL = 0x01

Variables

This section is empty.

Functions

func WriteConfigFile

func WriteConfigFile(cfg *Config) error

Types

type AlertEmail

type AlertEmail struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	From     string `yaml:"from"`
	Password string `yaml:"password"`
	To       string `yaml:"to"`
	Others   string `yaml:"others"`
	Interval int64  `yaml:"interval"`
}

type Config

type Config struct {
	Addr           string `yaml:"addr"`
	PrometheusAddr string `yaml:"prometheus_addr"`

	WebAddr     string `yaml:"web_addr"`
	WebUser     string `yaml:"web_user"`
	WebPassword string `yaml:"web_password"`

	TaskPeriod time.Duration `yaml:"task_period"`

	LogPath  string `yaml:"log_path"`
	LogLevel string `yaml:"log_level"`

	QueueType string `yaml:"queue_type"`
	QueueNum  int    `yaml:"queue_num"`

	Database *DataBase `mapstructer:"database"`

	EsConfig *EsConfig `yaml:"es_config"`

	AlertType  string      `yaml:"alert_type"`
	AlertEmail *AlertEmail `yaml:"alert_email"`

	SlowLogTime int    `yaml:"slow_log_time"`
	AllowIps    string `yaml:"allow_ips"`
	BlsFile     string `yaml:"blacklist_sql_file"`
	Charset     string `yaml:"proxy_charset"`
}

整个config文件对应的结构

func ParseConfigData

func ParseConfigData(data []byte) (*Config, error)

func ParseConfigFile

func ParseConfigFile(fileName string) (*Config, error)

type DataBase

type DataBase struct {
	Type        string `mapstructure:"type"`
	Host        string `mapstructure:"host"`
	User        string `mapstructure:"user"`
	Password    string `mapstructure:"password"`
	Name        string `mapstructure:"name"`
	TablePrefix string `mapstructure:"table-prefix"`
}

type EsConfig

type EsConfig struct {
	Host     string `yaml:"host"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
	Index    string `yaml:"index"`
	Type     string `yaml:"type"`
}

type SqlMsg

type SqlMsg struct {
	Id   uint   `json:"id"`
	Name string `json:"name"`
	Type int    `json:"type"`

	Transaction string `json:"transaction"`
	Src         string `json:"src"`
	Dst         string `json:"dst"`
	User        string `json:"user"`
	Time        int64  `json:"time"`
	Db          string `json:"db"`
	Cmd         byte   `json:"cmd"`
	Sql         string `json:"sql"`
	Op          int    `json:"op"`
	Alert       int    `json:"alert"`
	Error       int    `json:"error"`
	FingerPrint string `json:"fingerprint"`

	Rows   int `json:"rows"`
	Status int `json:"status"`
}

Jump to

Keyboard shortcuts

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