Documentation ¶
Index ¶
- Constants
- Variables
- func GetArg() (args *FlagArgsStruct, set StringSet, helper func())
- func MergeConfig(c *AppConfig, f *FlagArgsStruct, set StringSet) error
- func StringArrayVar(f *flag.FlagSet, ps *[]string, name, usage string)
- type AppConfig
- type BaseConfig
- type FlagArgsStruct
- type FlagValues
- type MaxConnectionsConfig
- type ModulesConfig
- type RateLimitConfig
- 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)
- type User
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" )
View Source
const DefaultHardMaxConnections = 65535
View Source
const DefaultHardMaxSucessConnections = 10
View Source
const DefaultMaxConnections = 100
View Source
const DefaultMaxSuccessConnections = 5
Variables ¶
Functions ¶
func MergeConfig ¶
func MergeConfig(c *AppConfig, f *FlagArgsStruct, set StringSet) error
Types ¶
type AppConfig ¶
type AppConfig struct { BaseConfig Modules ModulesConfig `toml:"modules"` }
func LoadFromFile ¶
func NewDefaultAppConfig ¶
func NewDefaultAppConfig() *AppConfig
func ParseConfig ¶
func (*AppConfig) FillDefault ¶ added in v0.5.0
func (c *AppConfig) FillDefault()
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"` RateLimits []*RateLimitConfig `toml:"rate_limit"` Users []*User `toml:"users"` MaxConn MaxConnectionsConfig `toml:"max_conn"` MaxSuccConn MaxConnectionsConfig `toml:"max_succ_conn"` } `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 // Rate Limit RateLimits []string // Users Users []string // Max connections MaxConns string // Max success connections MaxSuccConns string // Module Options Options []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 MaxConnectionsConfig ¶ added in v0.4.2
type ModulesConfig ¶
type ModulesConfig struct { GitServer gitserver.Config `toml:"gitserver"` FakeShell fakeshell.Config `toml:"fakeshell"` }
func (*ModulesConfig) FillDefault ¶ added in v0.5.0
func (c *ModulesConfig) FillDefault()
type RateLimitConfig ¶ added in v0.4.0
type RateLimitConfig = utils.RateLimitConfig
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.