mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-11 20:36:12 +02:00
lint: gocritic/typeDefFirst (ensure type definitions come before methods) (#3404)
* lint: gocritic/typeDefFirst (ensure type definitions come before methods) * lint
This commit is contained in:
parent
6f737a71f1
commit
5136d928ed
12 changed files with 80 additions and 65 deletions
|
@ -209,6 +209,36 @@ func (l *LocalApiClientCfg) Load() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
/*local api service configuration*/
|
||||
type LocalApiServerCfg struct {
|
||||
Enable *bool `yaml:"enable"`
|
||||
ListenURI string `yaml:"listen_uri,omitempty"` // 127.0.0.1:8080
|
||||
ListenSocket string `yaml:"listen_socket,omitempty"`
|
||||
TLS *TLSCfg `yaml:"tls"`
|
||||
DbConfig *DatabaseCfg `yaml:"-"`
|
||||
LogDir string `yaml:"-"`
|
||||
LogMedia string `yaml:"-"`
|
||||
OnlineClient *OnlineApiClientCfg `yaml:"online_client"`
|
||||
ProfilesPath string `yaml:"profiles_path,omitempty"`
|
||||
ConsoleConfigPath string `yaml:"console_path,omitempty"`
|
||||
ConsoleConfig *ConsoleConfig `yaml:"-"`
|
||||
Profiles []*ProfileCfg `yaml:"-"`
|
||||
LogLevel *log.Level `yaml:"log_level"`
|
||||
UseForwardedForHeaders bool `yaml:"use_forwarded_for_headers,omitempty"`
|
||||
TrustedProxies *[]string `yaml:"trusted_proxies,omitempty"`
|
||||
CompressLogs *bool `yaml:"-"`
|
||||
LogMaxSize int `yaml:"-"`
|
||||
LogMaxAge int `yaml:"-"`
|
||||
LogMaxFiles int `yaml:"-"`
|
||||
LogFormat string `yaml:"-"`
|
||||
TrustedIPs []string `yaml:"trusted_ips,omitempty"`
|
||||
PapiLogLevel *log.Level `yaml:"papi_log_level"`
|
||||
DisableRemoteLapiRegistration bool `yaml:"disable_remote_lapi_registration,omitempty"`
|
||||
CapiWhitelistsPath string `yaml:"capi_whitelists_path,omitempty"`
|
||||
CapiWhitelists *CapiWhitelist `yaml:"-"`
|
||||
AutoRegister *LocalAPIAutoRegisterCfg `yaml:"auto_registration,omitempty"`
|
||||
}
|
||||
|
||||
func (c *LocalApiServerCfg) GetTrustedIPs() ([]net.IPNet, error) {
|
||||
trustedIPs := make([]net.IPNet, 0)
|
||||
|
||||
|
@ -250,36 +280,6 @@ type LocalAPIAutoRegisterCfg struct {
|
|||
AllowedRangesParsed []*net.IPNet `yaml:"-"`
|
||||
}
|
||||
|
||||
/*local api service configuration*/
|
||||
type LocalApiServerCfg struct {
|
||||
Enable *bool `yaml:"enable"`
|
||||
ListenURI string `yaml:"listen_uri,omitempty"` // 127.0.0.1:8080
|
||||
ListenSocket string `yaml:"listen_socket,omitempty"`
|
||||
TLS *TLSCfg `yaml:"tls"`
|
||||
DbConfig *DatabaseCfg `yaml:"-"`
|
||||
LogDir string `yaml:"-"`
|
||||
LogMedia string `yaml:"-"`
|
||||
OnlineClient *OnlineApiClientCfg `yaml:"online_client"`
|
||||
ProfilesPath string `yaml:"profiles_path,omitempty"`
|
||||
ConsoleConfigPath string `yaml:"console_path,omitempty"`
|
||||
ConsoleConfig *ConsoleConfig `yaml:"-"`
|
||||
Profiles []*ProfileCfg `yaml:"-"`
|
||||
LogLevel *log.Level `yaml:"log_level"`
|
||||
UseForwardedForHeaders bool `yaml:"use_forwarded_for_headers,omitempty"`
|
||||
TrustedProxies *[]string `yaml:"trusted_proxies,omitempty"`
|
||||
CompressLogs *bool `yaml:"-"`
|
||||
LogMaxSize int `yaml:"-"`
|
||||
LogMaxAge int `yaml:"-"`
|
||||
LogMaxFiles int `yaml:"-"`
|
||||
LogFormat string `yaml:"-"`
|
||||
TrustedIPs []string `yaml:"trusted_ips,omitempty"`
|
||||
PapiLogLevel *log.Level `yaml:"papi_log_level"`
|
||||
DisableRemoteLapiRegistration bool `yaml:"disable_remote_lapi_registration,omitempty"`
|
||||
CapiWhitelistsPath string `yaml:"capi_whitelists_path,omitempty"`
|
||||
CapiWhitelists *CapiWhitelist `yaml:"-"`
|
||||
AutoRegister *LocalAPIAutoRegisterCfg `yaml:"auto_registration,omitempty"`
|
||||
}
|
||||
|
||||
func (c *LocalApiServerCfg) ClientURL() string {
|
||||
if c == nil {
|
||||
return ""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue