Documentation ¶
Index ¶
- Constants
- Variables
- func GetArg() (args *FlagArgsStruct, set StringSet, helper func())
- func MergeConfig(c *AppConfig, f *FlagArgsStruct, set StringSet) error
- func StringArrayVar(ps *[]string, name, usage string)
- type AppConfig
- type BaseConfig
- type FlagArgsStruct
- type FlagValues
- type ModulesConfig
- type StringSet
- func (s StringSet) Add(str string)
- func (s StringSet) Clone() StringSet
- func (s StringSet) Contains(x string) bool
- func (s StringSet) ContainsAll(xs ...string) bool
- func (s StringSet) ContainsOne(xs ...string) bool
- func (s StringSet) Equals(other StringSet) bool
- func (s StringSet) ForEach(fn func(string) error) error
- func (s StringSet) Keys() []string
- func (s StringSet) Len() int
- func (s StringSet) Remove(str string)
Constants ¶
View Source
const ( DefaultBind = ":22" DefaultSSHVersion = "OpenSSH_9.3p1" DefaultLogLevel = "info" DefaultLogFormat = "plain" DefaultLogPassword = false DefaultKeyType = "ed25519" DefaultMaxTry = 3 DefaultDelay = 0 DefaultDeviation = 0 DefaultEnableAntiScan = true DefaultSuccessRatio float64 = 0. )
View Source
const ( FlagLogFile = "log" FlagLogLevel = "level" FlagLogFormat = "format" FlagLogPasswd = "passwd" FlagKeyPaths = "key" FlagKeyType = "type" FlagBind = "bind" FlagSSHVersion = "version" FlagDelay = "delay" FlagDeviation = "devia" FlagMaxTry = "try" FlagEnableAntiScan = "a" FlagDisableAntiScan = "A" FlagSuccessRatio = "r" FlagSuccessSeed = "seed" )
Variables ¶
Functions ¶
func MergeConfig ¶
func MergeConfig(c *AppConfig, f *FlagArgsStruct, set StringSet) error
func StringArrayVar ¶
Types ¶
type AppConfig ¶
type AppConfig struct { BaseConfig Modules ModulesConfig `toml:"modules"` }
func LoadFromFile ¶
func NewDefaultAppConfig ¶
func NewDefaultAppConfig() *AppConfig
func ParseConfig ¶
type BaseConfig ¶
type BaseConfig struct { Server struct { ServPort string `toml:"bind"` SSHVersion string `toml:"version"` MaxTry int `toml:"max_try"` Delay int `toml:"delay"` Deviation int `toml:"deviation"` AntiScan bool `toml:"anti_scan"` SuccessRatio float64 `toml:"success_ratio"` SuccessSeed []byte `toml:"success_seed"` } `toml:"server"` Log struct { LogFile string `toml:"file"` LogLevel string `toml:"level"` LogFormat string `toml:"format"` IsLogPasswd bool `toml:"log_passwd"` } `toml:"log"` Key struct { KeyFiles []string `toml:"key"` KeyType string `toml:"type"` } `toml:"key"` }
func (*BaseConfig) CheckConfig ¶
func (c *BaseConfig) CheckConfig() error
func (*BaseConfig) FillDefault ¶
func (c *BaseConfig) FillDefault() error
type FlagArgsStruct ¶
type FlagArgsStruct struct { Help bool AppVersion bool // Log LogFile string LogLevel string LogFormat string // Key KeyFiles []string GenKeyFile bool KeyType string // Serve ServPort string SSHVersion string // Wait time Delay int Deviation int // Log password IsLogPasswd bool // Anti honeypot scan AntiScan bool // Max try times MaxTry int // ConfigPath ConfigPath string // Success Ratio SuccessRatio float64 // Success Seed SuccessSeed string }
FlagArgsStruct : a struct of args
type FlagValues ¶
type FlagValues []string
FlagValues : for multi values
func (*FlagValues) String ¶
func (p *FlagValues) String() string
String : implement for `flag.Value`
type ModulesConfig ¶
type StringSet ¶
type StringSet map[string]struct{}
func NewStringSet ¶
func (StringSet) ContainsAll ¶
func (StringSet) ContainsOne ¶
Click to show internal directories.
Click to hide internal directories.