Documentation
¶
Index ¶
- Variables
- func ReloadConfigFile() (err error)
- func SetTestEnvironmentConfig(env Environment)
- func SetTestFile(testFile File)
- type Backend
- type BackendServer
- func (n *BackendServer) GetHost() string
- func (n *BackendServer) GetPort() int
- func (n *BackendServer) GetProtocol() string
- func (n *BackendServer) GetRequestURI() string
- func (n *BackendServer) GetTestPassword() string
- func (n *BackendServer) GetTestUsername() string
- func (n *BackendServer) IsDeepCheck() bool
- func (n *BackendServer) IsHAProxyV2() bool
- func (n *BackendServer) IsTLS() bool
- func (n *BackendServer) IsTLSSkipVerify() bool
- func (n *BackendServer) String() string
- type BackendServerMonitoring
- type BasicAuth
- type BruteForceRule
- func (b *BruteForceRule) GetCIDR() uint
- func (b *BruteForceRule) GetFailedRequests() uint
- func (b *BruteForceRule) GetFilterByOIDCCID() []string
- func (b *BruteForceRule) GetFilterByProtocol() []string
- func (b *BruteForceRule) GetName() string
- func (b *BruteForceRule) GetPeriod() time.Duration
- func (b *BruteForceRule) IsIPv4() bool
- func (b *BruteForceRule) IsIPv6() bool
- func (b *BruteForceRule) String() string
- type BruteForceSection
- func (b *BruteForceSection) GetAdaptiveToleration() bool
- func (b *BruteForceSection) GetBuckets() []BruteForceRule
- func (b *BruteForceSection) GetCustomTolerations() []Tolerate
- func (b *BruteForceSection) GetIPWhitelist() []string
- func (b *BruteForceSection) GetMaxToleratePercent() uint8
- func (b *BruteForceSection) GetMinToleratePercent() uint8
- func (b *BruteForceSection) GetScaleFactor() float64
- func (b *BruteForceSection) GetSoftWhitelist() SoftWhitelist
- func (b *BruteForceSection) GetToleratePercent() uint8
- func (b *BruteForceSection) GetTolerateTTL() time.Duration
- func (b *BruteForceSection) LearnFromFeature(input string) bool
- func (b *BruteForceSection) String() string
- type Cluster
- func (c *Cluster) GetAddresses() []string
- func (c *Cluster) GetMaxRedirects() int
- func (c *Cluster) GetPassword() string
- func (c *Cluster) GetReadOnly() bool
- func (c *Cluster) GetReadTimeout() time.Duration
- func (c *Cluster) GetRouteByLatency() bool
- func (c *Cluster) GetRouteRandomly() bool
- func (c *Cluster) GetRouteReadsToReplicas() bool
- func (c *Cluster) GetUsername() string
- func (c *Cluster) GetWriteTimeout() time.Duration
- type Compression
- type DNS
- type DbgModule
- type DefaultHTTPRequestHeader
- func (d *DefaultHTTPRequestHeader) GetAuthMethod() string
- func (d *DefaultHTTPRequestHeader) GetClientHost() string
- func (d *DefaultHTTPRequestHeader) GetClientID() string
- func (d *DefaultHTTPRequestHeader) GetClientIP() string
- func (d *DefaultHTTPRequestHeader) GetClientPort() string
- func (d *DefaultHTTPRequestHeader) GetLocalIP() string
- func (d *DefaultHTTPRequestHeader) GetLocalPort() string
- func (d *DefaultHTTPRequestHeader) GetLoginAttempt() string
- func (d *DefaultHTTPRequestHeader) GetOIDCCID() string
- func (d *DefaultHTTPRequestHeader) GetPassword() string
- func (d *DefaultHTTPRequestHeader) GetPasswordEncoded() string
- func (d *DefaultHTTPRequestHeader) GetProtocol() string
- func (d *DefaultHTTPRequestHeader) GetSSL() string
- func (d *DefaultHTTPRequestHeader) GetSSLCipher() string
- func (d *DefaultHTTPRequestHeader) GetSSLClientCN() string
- func (d *DefaultHTTPRequestHeader) GetSSLClientIssuerDN() string
- func (d *DefaultHTTPRequestHeader) GetSSLClientNotAfter() string
- func (d *DefaultHTTPRequestHeader) GetSSLClientNotBefore() string
- func (d *DefaultHTTPRequestHeader) GetSSLClientSubjectDN() string
- func (d *DefaultHTTPRequestHeader) GetSSLFingerprint() string
- func (d *DefaultHTTPRequestHeader) GetSSLIssuer() string
- func (d *DefaultHTTPRequestHeader) GetSSLIssuerDN() string
- func (d *DefaultHTTPRequestHeader) GetSSLProtocol() string
- func (d *DefaultHTTPRequestHeader) GetSSLSerial() string
- func (d *DefaultHTTPRequestHeader) GetSSLSessionID() string
- func (d *DefaultHTTPRequestHeader) GetSSLSubject() string
- func (d *DefaultHTTPRequestHeader) GetSSLSubjectDN() string
- func (d *DefaultHTTPRequestHeader) GetSSLVerify() string
- func (d *DefaultHTTPRequestHeader) GetUsername() string
- type Endpoint
- func (e *Endpoint) IsAuthBasicDisabled() bool
- func (e *Endpoint) IsAuthHeaderDisabled() bool
- func (e *Endpoint) IsAuthJSONDisabled() bool
- func (e *Endpoint) IsAuthJWTDisabled() bool
- func (e *Endpoint) IsAuthNginxDisabled() bool
- func (e *Endpoint) IsAuthSASLAuthdDisabled() bool
- func (e *Endpoint) IsConfigurationDisabled() bool
- func (e *Endpoint) IsCustomHooksDisabled() bool
- type Environment
- type EnvironmentSettings
- func (env *EnvironmentSettings) GetDevMode() bool
- func (env *EnvironmentSettings) GetIMAPBackendAddress() string
- func (env *EnvironmentSettings) GetIMAPBackendPort() int
- func (env *EnvironmentSettings) GetLocalCacheAuthTTL() time.Duration
- func (env *EnvironmentSettings) GetMaxActionWorkers() uint16
- func (env *EnvironmentSettings) GetMaxLoginAttempts() uint8
- func (env *EnvironmentSettings) GetPOP3BackendAddress() string
- func (env *EnvironmentSettings) GetPOP3BackendPort() int
- func (env *EnvironmentSettings) GetSMTPBackendAddress() string
- func (env *EnvironmentSettings) GetSMTPBackendPort() int
- func (env *EnvironmentSettings) GetWaitDelay() uint8
- func (env *EnvironmentSettings) String() string
- type Feature
- type File
- type FileSettings
- func (f *FileSettings) GetAllProtocols() []string
- func (f *FileSettings) GetAuthMethod() string
- func (f *FileSettings) GetBackendServer(protocol string) *BackendServer
- func (f *FileSettings) GetBackendServerMonitoring() *BackendServerMonitoring
- func (f *FileSettings) GetBackendServers() []*BackendServer
- func (f *FileSettings) GetBruteForce() *BruteForceSection
- func (f *FileSettings) GetBruteForceRules() []BruteForceRule
- func (f *FileSettings) GetClearTextList() []string
- func (f *FileSettings) GetClientHost() string
- func (f *FileSettings) GetClientID() string
- func (f *FileSettings) GetClientIP() string
- func (f *FileSettings) GetClientPort() string
- func (f *FileSettings) GetConfig(backend definitions.Backend) any
- func (f *FileSettings) GetConfigFileAsJSON() ([]byte, error)
- func (f *FileSettings) GetLDAP() *LDAPSection
- func (f *FileSettings) GetLDAPConfigAuthIdlePoolSize() int
- func (f *FileSettings) GetLDAPConfigAuthPoolSize() int
- func (f *FileSettings) GetLDAPConfigBindDN() string
- func (f *FileSettings) GetLDAPConfigBindPW() string
- func (f *FileSettings) GetLDAPConfigConnectAbortTimeout() time.Duration
- func (f *FileSettings) GetLDAPConfigLookupIdlePoolSize() int
- func (f *FileSettings) GetLDAPConfigLookupPoolSize() int
- func (f *FileSettings) GetLDAPConfigNumberOfWorkers() int
- func (f *FileSettings) GetLDAPConfigSASLExternal() bool
- func (f *FileSettings) GetLDAPConfigServerURIs() []string
- func (f *FileSettings) GetLDAPConfigStartTLS() bool
- func (f *FileSettings) GetLDAPConfigTLSCAFile() string
- func (f *FileSettings) GetLDAPConfigTLSClientCert() string
- func (f *FileSettings) GetLDAPConfigTLSClientKey() string
- func (f *FileSettings) GetLDAPConfigTLSSkipVerify() bool
- func (f *FileSettings) GetLDAPOptionalPools() map[string]*LDAPConf
- func (f *FileSettings) GetLDAPSearchProtocol(protocol string, poolName string) (*LDAPSearchProtocol, error)
- func (f *FileSettings) GetLocalIP() string
- func (f *FileSettings) GetLocalPort() string
- func (f *FileSettings) GetLoginAttempt() string
- func (f *FileSettings) GetLua() *LuaSection
- func (f *FileSettings) GetLuaInitScriptPath() string
- func (f *FileSettings) GetLuaInitScriptPaths() []string
- func (f *FileSettings) GetLuaNumberOfWorkers() int
- func (f *FileSettings) GetLuaOptionalBackends() map[string]*LuaConf
- func (f *FileSettings) GetLuaPackagePath() string
- func (f *FileSettings) GetLuaScriptPath() string
- func (f *FileSettings) GetLuaSearchProtocol(protocol string, backendName string) (*LuaSearchProtocol, error)
- func (f *FileSettings) GetOIDCCID() string
- func (f *FileSettings) GetOauth2() *Oauth2Section
- func (f *FileSettings) GetPassword() string
- func (f *FileSettings) GetPasswordEncoded() string
- func (f *FileSettings) GetProtocol() string
- func (f *FileSettings) GetProtocols(backend definitions.Backend) any
- func (f *FileSettings) GetRBLs() *RBLSection
- func (f *FileSettings) GetRelayDomains() *RelayDomainsSection
- func (f *FileSettings) GetSSL() string
- func (f *FileSettings) GetSSLCipher() string
- func (f *FileSettings) GetSSLClientCN() string
- func (f *FileSettings) GetSSLClientIssuerDN() string
- func (f *FileSettings) GetSSLClientNotAfter() string
- func (f *FileSettings) GetSSLClientNotBefore() string
- func (f *FileSettings) GetSSLClientSubjectDN() string
- func (f *FileSettings) GetSSLFingerprint() string
- func (f *FileSettings) GetSSLIssuer() string
- func (f *FileSettings) GetSSLIssuerDN() string
- func (f *FileSettings) GetSSLProtocol() string
- func (f *FileSettings) GetSSLSerial() string
- func (f *FileSettings) GetSSLSessionID() string
- func (f *FileSettings) GetSSLSubject() string
- func (f *FileSettings) GetSSLSubjectDN() string
- func (f *FileSettings) GetSSLVerify() string
- func (f *FileSettings) GetSection(backend definitions.Backend) any
- func (f *FileSettings) GetServer() *ServerSection
- func (f *FileSettings) GetSkipConsent(clientId string) (skip bool)
- func (f *FileSettings) GetSkipTOTP(clientId string) (skip bool)
- func (f *FileSettings) GetUsername() string
- func (f *FileSettings) HandleFile() (err error)
- func (f *FileSettings) HasFeature(feature string) bool
- func (f *FileSettings) HaveLDAPBackend() bool
- func (f *FileSettings) HaveLua() bool
- func (f *FileSettings) HaveLuaActions() bool
- func (f *FileSettings) HaveLuaBackend() bool
- func (f *FileSettings) HaveLuaFeatures() bool
- func (f *FileSettings) HaveLuaFilters() bool
- func (f *FileSettings) HaveLuaHooks() bool
- func (f *FileSettings) HaveLuaInit() bool
- func (f *FileSettings) HaveServer() bool
- func (f *FileSettings) LDAPHavePoolOnly(backendName string) bool
- func (f *FileSettings) RetrieveGetterMap() map[definitions.Backend]GetterHandler
- type Frontend
- type GetterHandler
- type HTTPClient
- type IdTokenClaims
- func (i *IdTokenClaims) GetAddress() string
- func (i *IdTokenClaims) GetBirthdate() string
- func (i *IdTokenClaims) GetCustomClaims() map[string]any
- func (i *IdTokenClaims) GetEmail() string
- func (i *IdTokenClaims) GetEmailVerified() string
- func (i *IdTokenClaims) GetFamilyName() string
- func (i *IdTokenClaims) GetGender() string
- func (i *IdTokenClaims) GetGivenName() string
- func (i *IdTokenClaims) GetGroups() string
- func (i *IdTokenClaims) GetLocale() string
- func (i *IdTokenClaims) GetMiddleName() string
- func (i *IdTokenClaims) GetName() string
- func (i *IdTokenClaims) GetNickName() string
- func (i *IdTokenClaims) GetPhoneNumber() string
- func (i *IdTokenClaims) GetPhoneNumberVerified() string
- func (i *IdTokenClaims) GetPicture() string
- func (i *IdTokenClaims) GetPreferredUserName() string
- func (i *IdTokenClaims) GetProfile() string
- func (i *IdTokenClaims) GetUpdatedAt() string
- func (i *IdTokenClaims) GetWebsite() string
- func (i *IdTokenClaims) GetZoneInfo() string
- func (i *IdTokenClaims) String() string
- type Insights
- type JWTAuth
- func (j *JWTAuth) GetRefreshTokenExpiry() time.Duration
- func (j *JWTAuth) GetSecretKey() string
- func (j *JWTAuth) GetTokenExpiry() time.Duration
- func (j *JWTAuth) GetUsers() []*JWTUser
- func (j *JWTAuth) IsEnabled() bool
- func (j *JWTAuth) IsRefreshTokenEnabled() bool
- func (j *JWTAuth) IsStoreInRedisEnabled() bool
- type JWTUser
- type KeepAlive
- type LDAPAttributeMapping
- func (m *LDAPAttributeMapping) GetAAGUIDField() string
- func (m *LDAPAttributeMapping) GetCredentialIDField() string
- func (m *LDAPAttributeMapping) GetCredentialObject() string
- func (m *LDAPAttributeMapping) GetDisplayNameField() string
- func (m *LDAPAttributeMapping) GetPublicKeyField() string
- func (m *LDAPAttributeMapping) GetSignCountField() string
- func (m *LDAPAttributeMapping) GetTOTPRecoveryField() string
- func (m *LDAPAttributeMapping) GetTOTPSecretField() string
- func (m *LDAPAttributeMapping) GetUniqueUserIDField() string
- type LDAPConf
- func (l *LDAPConf) GetAuthIdlePoolSize() int
- func (l *LDAPConf) GetAuthPoolSize() int
- func (l *LDAPConf) GetBindDN() string
- func (l *LDAPConf) GetBindPW() string
- func (l *LDAPConf) GetConnectAbortTimeout() time.Duration
- func (l *LDAPConf) GetLookupIdlePoolSize() int
- func (l *LDAPConf) GetLookupPoolSize() int
- func (l *LDAPConf) GetNumberOfWorkers() int
- func (l *LDAPConf) GetServerURIs() []string
- func (l *LDAPConf) GetTLSCAFile() string
- func (l *LDAPConf) GetTLSClientCert() string
- func (l *LDAPConf) GetTLSClientKey() string
- func (l *LDAPConf) IsPoolOnly() bool
- func (l *LDAPConf) IsSASLExternal() bool
- func (l *LDAPConf) IsStartTLS() bool
- func (l *LDAPConf) IsTLSSkipVerify() bool
- func (l *LDAPConf) String() string
- type LDAPFilter
- type LDAPScope
- type LDAPSearchProtocol
- func (p *LDAPSearchProtocol) GetAccountField() (string, error)
- func (p *LDAPSearchProtocol) GetAttributes() ([]string, error)
- func (p *LDAPSearchProtocol) GetBaseDN() (string, error)
- func (p *LDAPSearchProtocol) GetCacheName() (string, error)
- func (p *LDAPSearchProtocol) GetListAccountsFilter() (string, error)
- func (p *LDAPSearchProtocol) GetPoolName() string
- func (p *LDAPSearchProtocol) GetProtocols() []string
- func (p *LDAPSearchProtocol) GetScope() (*LDAPScope, error)
- func (p *LDAPSearchProtocol) GetUserFilter() (string, error)
- type LDAPSection
- type Log
- type LuaAction
- type LuaConf
- type LuaFeature
- type LuaFilter
- type LuaHooks
- type LuaSearchProtocol
- type LuaSection
- func (l *LuaSection) GetActions() []LuaAction
- func (l *LuaSection) GetConfig() any
- func (l *LuaSection) GetFeatures() []LuaFeature
- func (l *LuaSection) GetFilters() []LuaFilter
- func (l *LuaSection) GetHooks() []LuaHooks
- func (l *LuaSection) GetOptionalLuaBackends() map[string]*LuaConf
- func (l *LuaSection) GetProtocols() any
- func (l *LuaSection) String() string
- type Master
- type MasterUser
- type OIDCCustomClaim
- type Oauth2Client
- type Oauth2CustomScope
- type Oauth2Section
- type PrometheusTimer
- type Protocol
- type RBL
- type RBLSection
- type Redis
- func (r *Redis) GetCluster() *Cluster
- func (r *Redis) GetDatabaseNumber() int
- func (r *Redis) GetIdlePoolSize() int
- func (r *Redis) GetNegCacheTTL() time.Duration
- func (r *Redis) GetPasswordNonce() string
- func (r *Redis) GetPoolSize() int
- func (r *Redis) GetPosCacheTTL() time.Duration
- func (r *Redis) GetPrefix() string
- func (r *Redis) GetSentinel() *Sentinels
- func (r *Redis) GetStandaloneMaster() Master
- func (r *Redis) GetStandaloneReplica() Replica
- func (r *Redis) GetTLS() *TLS
- type RelayDomainsSection
- type Replica
- type Sentinels
- type ServerSection
- func (s *ServerSection) GetBackends() []*Backend
- func (s *ServerSection) GetBasicAuth() *BasicAuth
- func (s *ServerSection) GetBruteForceProtocols() []*Protocol
- func (s *ServerSection) GetCompression() *Compression
- func (s *ServerSection) GetDNS() *DNS
- func (s *ServerSection) GetDefaultHTTPRequestHeader() *DefaultHTTPRequestHeader
- func (s *ServerSection) GetEndpoint() *Endpoint
- func (s *ServerSection) GetFeatures() []*Feature
- func (s *ServerSection) GetHTTPClient() *HTTPClient
- func (s *ServerSection) GetInsights() *Insights
- func (s *ServerSection) GetInstanceName() string
- func (s *ServerSection) GetJWTAuth() *JWTAuth
- func (s *ServerSection) GetKeepAlive() *KeepAlive
- func (s *ServerSection) GetListenAddress() string
- func (s *ServerSection) GetLog() *Log
- func (s *ServerSection) GetMasterUser() *MasterUser
- func (s *ServerSection) GetMaxConcurrentRequests() int32
- func (s *ServerSection) GetMaxPasswordHistoryEntries() int32
- func (s *ServerSection) GetPrometheusTimer() *PrometheusTimer
- func (s *ServerSection) GetRedis() *Redis
- func (s *ServerSection) GetTLS() *TLS
- func (s *ServerSection) IsHAproxyProtocolEnabled() bool
- func (s *ServerSection) IsHTTP3Enabled() bool
- type SoftWhitelist
- type SoftWhitelistProvider
- type StringSet
- type TLS
- type Tolerate
- func (t *Tolerate) GetAdaptiveToleration() bool
- func (t *Tolerate) GetIPAddress() string
- func (t *Tolerate) GetMaxToleratePercent() uint8
- func (t *Tolerate) GetMinToleratePercent() uint8
- func (t *Tolerate) GetScaleFactor() float64
- func (t *Tolerate) GetToleratePercent() uint8
- func (t *Tolerate) GetTolerateTTL() time.Duration
- type Verbosity
Constants ¶
This section is empty.
Variables ¶
var ( Matcher language.Matcher DefaultLanguageTags []language.Tag )
var ConfigFilePath string
ConfigFilePath stores the path to the configuration file specified via the -config flag
Functions ¶
func ReloadConfigFile ¶
func ReloadConfigFile() (err error)
ReloadConfigFile is a thread safe function to reload a ConfigFile object.
func SetTestEnvironmentConfig ¶ added in v1.5.4
func SetTestEnvironmentConfig(env Environment)
SetTestEnvironmentConfig sets the environment configuration for the test environment using the provided Environment interface.
func SetTestFile ¶ added in v1.4.10
func SetTestFile(testFile File)
SetTestFile sets the global `file` variable to the provided `testFile` implementing the `File` interface.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is a password Database container.
func (*Backend) Get ¶
func (b *Backend) Get() definitions.Backend
Get gets the name of a password Database.
func (*Backend) GetName ¶ added in v1.5.0
GetName returns the name of the Backend instance or an empty string if the instance is nil.
func (*Backend) Set ¶
Set updates the backend of the Backend based on the provided value. It returns an error if the value is not valid. Valid values for the backend are "cache", "ldap" and "lua". If the value is valid, the backend field of Backend is updated accordingly. An error of type ErrWrongPassDB is returned if the value is not valid.
type BackendServer ¶
type BackendServer struct {
Protocol string `mapstructure:"protocol" validate:"required,oneof=imap pop3 lmtp smtp sieve http"`
Host string `mapstructure:"host" validate:"required,hostname|ip"`
DeepCheck bool `mapstructure:"deep_check"`
RequestURI string `mapstructure:"request_uri" validate:"omitempty,url_encoded"`
TestUsername string `mapstructure:"test_username" validate:"omitempty,excludesall= "`
TestPassword string `mapstructure:"test_password" validate:"omitempty,excludesall= "`
Port int `mapstructure:"port" validate:"omitempty,min=1,max=65535"`
TLS bool `mapstructure:"tls"`
TLSSkipVerify bool `mapstructure:"tls_skip_verify"`
HAProxyV2 bool `mapstructure:"haproxy_v2"`
}
func (*BackendServer) GetHost ¶ added in v1.7.7
func (n *BackendServer) GetHost() string
GetHost retrieves the host value from the BackendServer. Returns an empty string if the BackendServer is nil.
func (*BackendServer) GetPort ¶ added in v1.7.7
func (n *BackendServer) GetPort() int
GetPort retrieves the port number from the BackendServer. Returns 0 if the BackendServer is nil.
func (*BackendServer) GetProtocol ¶ added in v1.7.7
func (n *BackendServer) GetProtocol() string
GetProtocol retrieves the protocol value from the BackendServer. Returns an empty string if the BackendServer is nil.
func (*BackendServer) GetRequestURI ¶ added in v1.7.7
func (n *BackendServer) GetRequestURI() string
GetRequestURI retrieves the request URI from the BackendServer. Returns an empty string if the BackendServer is nil.
func (*BackendServer) GetTestPassword ¶ added in v1.7.7
func (n *BackendServer) GetTestPassword() string
GetTestPassword retrieves the test password from the BackendServer. Returns an empty string if the BackendServer is nil.
func (*BackendServer) GetTestUsername ¶ added in v1.7.7
func (n *BackendServer) GetTestUsername() string
GetTestUsername retrieves the test username from the BackendServer. Returns an empty string if the BackendServer is nil.
func (*BackendServer) IsDeepCheck ¶ added in v1.7.7
func (n *BackendServer) IsDeepCheck() bool
IsDeepCheck checks if deep checking is enabled for the BackendServer. Returns false if the BackendServer is nil.
func (*BackendServer) IsHAProxyV2 ¶ added in v1.7.7
func (n *BackendServer) IsHAProxyV2() bool
IsHAProxyV2 checks if HAProxy protocol version 2 is enabled for the BackendServer. Returns false if the BackendServer is nil.
func (*BackendServer) IsTLS ¶ added in v1.7.7
func (n *BackendServer) IsTLS() bool
IsTLS checks if TLS is enabled for the BackendServer. Returns false if the BackendServer is nil.
func (*BackendServer) IsTLSSkipVerify ¶ added in v1.7.7
func (n *BackendServer) IsTLSSkipVerify() bool
IsTLSSkipVerify checks if TLS verification should be skipped for the BackendServer. Returns false if the BackendServer is nil.
func (*BackendServer) String ¶
func (n *BackendServer) String() string
type BackendServerMonitoring ¶
type BackendServerMonitoring struct {
BackendServers []*BackendServer `mapstructure:"backend_servers" validate:"required,dive"`
}
func (*BackendServerMonitoring) GetBackendServers ¶ added in v1.7.7
func (n *BackendServerMonitoring) GetBackendServers() []*BackendServer
GetBackendServers retrieves the list of backend servers from the BackendServerMonitoring. Returns an empty slice if the BackendServerMonitoring is nil.
func (*BackendServerMonitoring) String ¶ added in v1.3.5
func (n *BackendServerMonitoring) String() string
type BasicAuth ¶
type BasicAuth struct {
Enabled bool `mapstructure:"enabled"`
Username string `mapstructure:"username" validate:"omitempty,excludesall= "`
Password string `mapstructure:"password" validate:"omitempty,min=16,alphanumsymbol,excludesall= "`
}
BasicAuth represents the configuration for basic HTTP authentication.
func (*BasicAuth) GetPassword ¶ added in v1.4.11
GetPassword retrieves the password for the BasicAuth configuration. Returns an empty string if the BasicAuth is nil.
func (*BasicAuth) GetUsername ¶ added in v1.4.11
GetUsername returns the username configured for basic HTTP authentication. Returns an empty string if the BasicAuth is nil.
type BruteForceRule ¶
type BruteForceRule struct {
Name string `mapstructure:"name" validate:"required"`
Period time.Duration `mapstructure:"period" validate:"required,gt=0,max=8760h"`
CIDR uint `mapstructure:"cidr" validate:"required,min=1,max=128"`
IPv4 bool
IPv6 bool
FailedRequests uint `mapstructure:"failed_requests" validate:"required,min=1"`
FilterByProtocol []string `mapstructure:"filter_by_protocol" validate:"omitempty"`
FilterByOIDCCID []string `mapstructure:"filter_by_oidc_cid" validate:"omitempty"`
}
BruteForceRule is the definition of a brute force rule as defined in the configuration file. See the markdown documentation for a description of the field names.
func (*BruteForceRule) GetCIDR ¶ added in v1.7.7
func (b *BruteForceRule) GetCIDR() uint
GetCIDR retrieves the CIDR value for the brute force rule. Returns 0 if the BruteForceRule is nil.
func (*BruteForceRule) GetFailedRequests ¶ added in v1.7.7
func (b *BruteForceRule) GetFailedRequests() uint
GetFailedRequests retrieves the number of failed requests threshold for the brute force rule. Returns 0 if the BruteForceRule is nil.
func (*BruteForceRule) GetFilterByOIDCCID ¶ added in v1.7.7
func (b *BruteForceRule) GetFilterByOIDCCID() []string
GetFilterByOIDCCID retrieves the list of OIDC client IDs to filter by for the brute force rule. Returns an empty slice if the BruteForceRule is nil.
func (*BruteForceRule) GetFilterByProtocol ¶ added in v1.7.7
func (b *BruteForceRule) GetFilterByProtocol() []string
GetFilterByProtocol retrieves the list of protocols to filter by for the brute force rule. Returns an empty slice if the BruteForceRule is nil.
func (*BruteForceRule) GetName ¶ added in v1.7.7
func (b *BruteForceRule) GetName() string
GetName retrieves the name of the brute force rule. Returns an empty string if the BruteForceRule is nil.
func (*BruteForceRule) GetPeriod ¶ added in v1.7.7
func (b *BruteForceRule) GetPeriod() time.Duration
GetPeriod retrieves the period duration for the brute force rule. Returns 0 if the BruteForceRule is nil.
func (*BruteForceRule) IsIPv4 ¶ added in v1.7.7
func (b *BruteForceRule) IsIPv4() bool
IsIPv4 checks if the brute force rule is configured for IPv4. Returns false if the BruteForceRule is nil.
func (*BruteForceRule) IsIPv6 ¶ added in v1.7.7
func (b *BruteForceRule) IsIPv6() bool
IsIPv6 checks if the brute force rule is configured for IPv6. Returns false if the BruteForceRule is nil.
func (*BruteForceRule) String ¶ added in v1.4.9
func (b *BruteForceRule) String() string
type BruteForceSection ¶
type BruteForceSection struct {
SoftWhitelist `mapstructure:"soft_whitelist"`
IPWhitelist []string `mapstructure:"ip_whitelist" validate:"omitempty,dive,ip_addr|cidr"`
Buckets []BruteForceRule `mapstructure:"buckets" validate:"required,dive"`
Learning []*Feature `mapstructure:"learning" validate:"omitempty,dive"`
ToleratePercent uint8 `mapstructure:"tolerate_percent" validate:"omitempty,min=0,max=100"`
CustomTolerations []Tolerate `mapstructure:"custom_tolerations" validate:"omitempty,dive"`
TolerateTTL time.Duration `mapstructure:"tolerate_ttl" validate:"omitempty,gt=0,max=8760h"`
AdaptiveToleration bool `mapstructure:"adaptive_toleration"`
MinToleratePercent uint8 `mapstructure:"min_tolerate_percent" validate:"omitempty,min=0,max=100"`
MaxToleratePercent uint8 `mapstructure:"max_tolerate_percent" validate:"omitempty,min=0,max=100"`
ScaleFactor float64 `mapstructure:"scale_factor" validate:"omitempty,min=0.1,max=10"`
}
func (*BruteForceSection) GetAdaptiveToleration ¶ added in v1.7.7
func (b *BruteForceSection) GetAdaptiveToleration() bool
GetAdaptiveToleration retrieves the AdaptiveToleration value from the BruteForceSection instance. Returns false if the receiver is nil.
func (*BruteForceSection) GetBuckets ¶ added in v1.7.7
func (b *BruteForceSection) GetBuckets() []BruteForceRule
GetBuckets retrieves the list of brute force rules from the BruteForceSection. Returns an empty slice if the BruteForceSection is nil.
func (*BruteForceSection) GetCustomTolerations ¶ added in v1.5.1
func (b *BruteForceSection) GetCustomTolerations() []Tolerate
GetCustomTolerations returns the CustomTolerations slice from the BruteForceSection. Returns an empty slice if the receiver is nil.
func (*BruteForceSection) GetIPWhitelist ¶ added in v1.7.7
func (b *BruteForceSection) GetIPWhitelist() []string
GetIPWhitelist retrieves the IP whitelist from the BruteForceSection. Returns an empty slice if the BruteForceSection is nil.
func (*BruteForceSection) GetMaxToleratePercent ¶ added in v1.7.7
func (b *BruteForceSection) GetMaxToleratePercent() uint8
GetMaxToleratePercent retrieves the MaxToleratePercent value from the BruteForceSection instance. Returns 50 as default if not set or if the receiver is nil.
func (*BruteForceSection) GetMinToleratePercent ¶ added in v1.7.7
func (b *BruteForceSection) GetMinToleratePercent() uint8
GetMinToleratePercent retrieves the MinToleratePercent value from the BruteForceSection instance. Returns 10 as default if not set or if the receiver is nil.
func (*BruteForceSection) GetScaleFactor ¶ added in v1.7.7
func (b *BruteForceSection) GetScaleFactor() float64
GetScaleFactor retrieves the ScaleFactor value from the BruteForceSection instance. Returns 1.0 as default if not set or if the receiver is nil.
func (*BruteForceSection) GetSoftWhitelist ¶ added in v1.7.7
func (b *BruteForceSection) GetSoftWhitelist() SoftWhitelist
GetSoftWhitelist retrieves the SoftWhitelist from the BruteForceSection. Returns an empty map if the BruteForceSection is nil.
func (*BruteForceSection) GetToleratePercent ¶ added in v1.5.1
func (b *BruteForceSection) GetToleratePercent() uint8
GetToleratePercent retrieves the ToleratePercent value from the BruteForceSection instance. Returns 0 if the receiver is nil.
func (*BruteForceSection) GetTolerateTTL ¶ added in v1.5.1
func (b *BruteForceSection) GetTolerateTTL() time.Duration
GetTolerateTTL retrieves the TolerateTTL value from the BruteForceSection instance. Returns 0 if the receiver is nil.
func (*BruteForceSection) LearnFromFeature ¶ added in v1.3.5
func (b *BruteForceSection) LearnFromFeature(input string) bool
LearnFromFeature checks if the given feature is present in the Learning slice of the BruteForceSection. It returns true if the feature is found, otherwise false.
func (*BruteForceSection) String ¶
func (b *BruteForceSection) String() string
type Cluster ¶
type Cluster struct {
Addresses []string `mapstructure:"addresses" validate:"required,dive,hostname_port"`
Username string `mapstructure:"username" validate:"omitempty,excludesall= "`
Password string `mapstructure:"password" validate:"omitempty,excludesall= "`
RouteByLatency bool `mapstructure:"route_by_latency"`
RouteRandomly bool `mapstructure:"route_randomly"`
ReadOnly bool `mapstructure:"read_only"` // Deprecated: Use RouteReadsToReplicas instead
RouteReadsToReplicas bool `mapstructure:"route_reads_to_replicas"`
MaxRedirects int `mapstructure:"max_redirects" validate:"omitempty,gte=0"`
ReadTimeout time.Duration `mapstructure:"read_timeout" validate:"omitempty"`
WriteTimeout time.Duration `mapstructure:"write_timeout" validate:"omitempty"`
}
Cluster represents the configuration for a Redis cluster setup.
func (*Cluster) GetAddresses ¶ added in v1.4.11
GetAddresses retrieves the list of Redis cluster addresses configured in the Cluster instance. Returns an empty slice if the Cluster is nil.
func (*Cluster) GetMaxRedirects ¶ added in v1.7.1
GetMaxRedirects returns the maximum number of redirects to follow. Returns 0 if the Cluster is nil.
func (*Cluster) GetPassword ¶ added in v1.4.11
GetPassword retrieves the password configured for the Redis cluster. Returns an empty string if the Cluster is nil.
func (*Cluster) GetReadOnly ¶ added in v1.7.1
GetReadOnly returns whether read-only commands should be allowed from replicas. Returns false if the Cluster is nil. Deprecated: Use GetRouteReadsToReplicas instead.
func (*Cluster) GetReadTimeout ¶ added in v1.7.1
GetReadTimeout returns the timeout for read operations. Returns 0 if the Cluster is nil.
func (*Cluster) GetRouteByLatency ¶ added in v1.7.1
GetRouteByLatency returns whether commands should be routed to the closest node. Returns false if the Cluster is nil.
func (*Cluster) GetRouteRandomly ¶ added in v1.7.1
GetRouteRandomly returns whether commands should be routed randomly across nodes. Returns false if the Cluster is nil.
func (*Cluster) GetRouteReadsToReplicas ¶ added in v1.7.11
GetRouteReadsToReplicas returns whether read commands should be routed to replica nodes. Returns false if the Cluster is nil.
func (*Cluster) GetUsername ¶ added in v1.4.11
GetUsername retrieves the username configured for the Redis cluster. Returns an empty string if the Cluster is nil.
func (*Cluster) GetWriteTimeout ¶ added in v1.7.1
GetWriteTimeout returns the timeout for write operations. Returns 0 if the Cluster is nil.
type Compression ¶ added in v1.7.3
type Compression struct {
Enabled bool `mapstructure:"enabled"`
Level int `mapstructure:"level" validate:"omitempty,gte=1,lte=9"`
ContentTypes []string `mapstructure:"content_types" validate:"omitempty,dive,printascii"`
MinLength int `mapstructure:"min_length" validate:"omitempty,gte=0"`
}
Compression represents the configuration for HTTP response compression.
func (*Compression) GetContentTypes ¶ added in v1.7.3
func (c *Compression) GetContentTypes() []string
GetContentTypes returns the list of content types that should be compressed. Returns an empty slice if the Compression is nil.
func (*Compression) GetLevel ¶ added in v1.7.3
func (c *Compression) GetLevel() int
GetLevel returns the compression level (1-9, where 1 is fastest and 9 is best compression). Returns 0 if the Compression is nil.
func (*Compression) GetMinLength ¶ added in v1.7.3
func (c *Compression) GetMinLength() int
GetMinLength returns the minimum content length required for compression. Returns 0 if the Compression is nil.
func (*Compression) IsEnabled ¶ added in v1.7.3
func (c *Compression) IsEnabled() bool
IsEnabled returns true if compression is enabled, otherwise false. Returns false if the Compression is nil.
type DNS ¶
type DNS struct {
Resolver string `mapstructure:"resolver" validate:"omitempty,tcp_addr"`
Timeout time.Duration `mapstructure:"timeout" validate:"omitempty,gt=0,max=30s"`
ResolveClientIP bool `mapstructure:"resolve_client_ip"`
}
DNS represents the Domain Name System configuration settings, including resolver, timeout, and client IP resolution options.
func (*DNS) GetResolveClientIP ¶ added in v1.4.11
GetResolveClientIP returns the value of the ResolveClientIP field indicating whether client IP resolution is enabled. Returns false if the DNS is nil.
func (*DNS) GetResolver ¶ added in v1.4.11
GetResolver returns the configured DNS resolver address as a string. Returns an empty string if the DNS is nil.
func (*DNS) GetTimeout ¶ added in v1.4.11
GetTimeout returns the timeout duration configured for the DNS resolver. Returns 0 if the DNS is nil.
type DbgModule ¶
type DbgModule struct {
// contains filtered or unexported fields
}
DbgModule represents a debugging module configuration.
func (*DbgModule) Get ¶
Get returns the name of the `DbgModule` instance. The name represents the current debug module. It can be used to identify the debug module when needed.
func (*DbgModule) GetModule ¶
func (d *DbgModule) GetModule() definitions.DbgModule
GetModule returns the `module` field of the `DbgModule` struct. It is used to retrieve the current debug module.
Usage:
module := d.GetModule()
Example:
func main() {
dbg := &DbgModule{}
module := dbg.GetModule()
fmt.Println(module) // Output: 0
}
func (*DbgModule) Set ¶
Set updates the debug module based on the provided value. It returns an error if the value is not valid. Valid values for the debug module are "none", "all", "auth", "hydra", "webauthn", "statistics", "whitelist", "ldap", "ldappool", "sql", "cache", "bf", "rbl", "action", "feature", and "lua". If the value is valid, the module and name fields are updated accordingly. An error of type ErrWrongDebugModule is returned if the value is not valid.
type DefaultHTTPRequestHeader ¶ added in v1.3.0
type DefaultHTTPRequestHeader struct {
Username string `mapstructure:"username" validate:"omitempty,printascii,excludesall= "`
Password string `mapstructure:"password" validate:"omitempty,printascii,excludesall= "`
PasswordEncoded string `mapstructure:"password_encoded" validate:"omitempty,printascii,excludesall= "`
Protocol string `mapstructure:"protocol" validate:"omitempty,printascii,excludesall= "`
LoginAttempt string `mapstructure:"login_attempt" validate:"omitempty,printascii,excludesall= "`
AuthMethod string `mapstructure:"auth_method" validate:"omitempty,printascii,excludesall= "`
LocalIP string `mapstructure:"local_ip" validate:"omitempty,printascii,excludesall= "`
LocalPort string `mapstructure:"local_port" validate:"omitempty,printascii,excludesall= "`
ClientIP string `mapstructure:"client_ip" validate:"omitempty,printascii,excludesall= "`
ClientPort string `mapstructure:"client_port" validate:"omitempty,printascii,excludesall= "`
ClientHost string `mapstructure:"client_host" validate:"omitempty,printascii,excludesall= "`
ClientID string `mapstructure:"client_id" validate:"omitempty,printascii,excludesall= "`
SSL string `mapstructure:"ssl" validate:"omitempty,printascii,excludesall= "`
SSLSessionID string `mapstructure:"ssl_session_id" validate:"omitempty,printascii,excludesall= "`
SSLVerify string `mapstructure:"ssl_verify" validate:"omitempty,printascii,excludesall= "`
SSLSubject string `mapstructure:"ssl_subject" validate:"omitempty,printascii,excludesall= "`
SSLClientCN string `mapstructure:"ssl_client_cn" validate:"omitempty,printascii,excludesall= "`
SSLIssuer string `mapstructure:"ssl_issuer" validate:"omitempty,printascii,excludesall= "`
SSLClientNotBefore string `mapstructure:"ssl_client_not_before" validate:"omitempty,printascii,excludesall= "`
SSLClientNotAfter string `mapstructure:"ssl_client_not_after" validate:"omitempty,printascii,excludesall= "`
SSLSubjectDN string `mapstructure:"ssl_subject_dn" validate:"omitempty,printascii,excludesall= "`
SSLIssuerDN string `mapstructure:"ssl_issuer_dn" validate:"omitempty,printascii,excludesall= "`
SSLClientSubjectDN string `mapstructure:"ssl_client_subject_dn" validate:"omitempty,printascii,excludesall= "`
SSLClientIssuerDN string `mapstructure:"ssl_client_issuer_dn" validate:"omitempty,printascii,excludesall= "`
SSLCipher string `mapstructure:"ssl_cipher" validate:"omitempty,printascii,excludesall= "`
SSLProtocol string `mapstructure:"ssl_protocol" validate:"omitempty,printascii,excludesall= "`
SSLSerial string `mapstructure:"ssl_serial" validate:"omitempty,printascii,excludesall= "`
SSLFingerprint string `mapstructure:"ssl_fingerprint" validate:"omitempty,printascii,excludesall= "`
OIDCCID string `mapstructure:"oidc_cid" validate:"omitempty,printascii,excludesall= "`
}
DefaultHTTPRequestHeader represents the default headers to include in every HTTP request. This struct includes fields for authentication, SSL/TLS, and client/server metadata.
func (*DefaultHTTPRequestHeader) GetAuthMethod ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetAuthMethod() string
GetAuthMethod retrieves the authentication method value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetClientHost ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetClientHost() string
GetClientHost retrieves the client host value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetClientID ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetClientID() string
GetClientID retrieves the client identifier from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetClientIP ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetClientIP() string
GetClientIP retrieves the client's IP address from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetClientPort ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetClientPort() string
GetClientPort retrieves the client port value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetLocalIP ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetLocalIP() string
GetLocalIP retrieves the local IP address from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetLocalPort ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetLocalPort() string
GetLocalPort retrieves the local port value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetLoginAttempt ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetLoginAttempt() string
GetLoginAttempt retrieves the login attempt value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetOIDCCID ¶ added in v1.7.5
func (d *DefaultHTTPRequestHeader) GetOIDCCID() string
GetOIDCCID retrieves the OIDC Client ID value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetPassword ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetPassword() string
GetPassword retrieves the password value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetPasswordEncoded ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetPasswordEncoded() string
GetPasswordEncoded retrieves the encoded password value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetProtocol ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetProtocol() string
GetProtocol retrieves the protocol value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSL ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSL() string
GetSSL retrieves the SSL value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLCipher ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLCipher() string
GetSSLCipher retrieves the SSL cipher value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLClientCN ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLClientCN() string
GetSSLClientCN retrieves the Common Name (CN) from the SSL client certificate in the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLClientIssuerDN ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLClientIssuerDN() string
GetSSLClientIssuerDN retrieves the SSL client issuer distinguished name (DN) from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLClientNotAfter ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLClientNotAfter() string
GetSSLClientNotAfter retrieves the SSL client certificate expiration date from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLClientNotBefore ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLClientNotBefore() string
GetSSLClientNotBefore retrieves the SSL client certificate start date from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLClientSubjectDN ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLClientSubjectDN() string
GetSSLClientSubjectDN retrieves the SSL client subject distinguished name (DN) from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLFingerprint ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLFingerprint() string
GetSSLFingerprint retrieves the SSL fingerprint value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLIssuer ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLIssuer() string
GetSSLIssuer retrieves the SSL issuer value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLIssuerDN ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLIssuerDN() string
GetSSLIssuerDN retrieves the SSL issuer distinguished name (DN) from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLProtocol ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLProtocol() string
GetSSLProtocol retrieves the SSL protocol value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLSerial ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLSerial() string
GetSSLSerial retrieves the SSL serial number from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLSessionID ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLSessionID() string
GetSSLSessionID retrieves the SSL session ID from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLSubject ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLSubject() string
GetSSLSubject retrieves the SSL subject value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLSubjectDN ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLSubjectDN() string
GetSSLSubjectDN retrieves the SSL subject distinguished name (DN) from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetSSLVerify ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLVerify() string
GetSSLVerify retrieves the SSL verification setting from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
func (*DefaultHTTPRequestHeader) GetUsername ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetUsername() string
GetUsername retrieves the username value from the DefaultHTTPRequestHeader struct. Returns an empty string if the DefaultHTTPRequestHeader is nil.
type Endpoint ¶ added in v1.4.9
type Endpoint struct {
AuthHeader bool `mapstructure:"auth_header"`
AuthJSON bool `mapstructure:"auth_json"`
AuthBasic bool `mapstructure:"auth_basic"`
AuthNginx bool `mapstructure:"auth_nginx"`
AuthSASLAuthd bool `mapstructure:"auth_saslauthd"`
AuthJWT bool `mapstructure:"auth_jwt"`
CustomHooks bool `mapstructure:"custom_hooks"`
Configuration bool `mapstructure:"configuration"`
}
Endpoint defines a structure for configuring various types of authentication and custom hooks.
func (*Endpoint) IsAuthBasicDisabled ¶ added in v1.7.0
IsAuthBasicDisabled checks if Basic authentication is enabled for the endpoint and returns the corresponding boolean value. Returns false if the Endpoint is nil.
func (*Endpoint) IsAuthHeaderDisabled ¶ added in v1.7.0
IsAuthHeaderDisabled checks if header-based authentication is enabled for the endpoint and returns the corresponding boolean value. Returns false if the Endpoint is nil.
func (*Endpoint) IsAuthJSONDisabled ¶ added in v1.7.0
IsAuthJSONDisabled checks if JSON-based authentication is enabled for the endpoint and returns the corresponding boolean value. Returns false if the Endpoint is nil.
func (*Endpoint) IsAuthJWTDisabled ¶ added in v1.7.0
IsAuthJWTDisabled checks if JWT authentication is enabled for the endpoint and returns the corresponding boolean value. Returns false if the Endpoint is nil.
func (*Endpoint) IsAuthNginxDisabled ¶ added in v1.7.0
IsAuthNginxDisabled checks if Nginx-based authentication is enabled for the endpoint and returns the corresponding boolean value. Returns false if the Endpoint is nil.
func (*Endpoint) IsAuthSASLAuthdDisabled ¶ added in v1.7.0
IsAuthSASLAuthdDisabled checks if SASL authentication is enabled for the endpoint and returns the corresponding boolean value. Returns false if the Endpoint is nil.
func (*Endpoint) IsConfigurationDisabled ¶ added in v1.7.11
IsConfigurationDisabled checks if the configuration setting is enabled for the endpoint and returns the corresponding boolean value. Returns false if the Endpoint is nil.
func (*Endpoint) IsCustomHooksDisabled ¶ added in v1.7.0
IsCustomHooksDisabled checks if custom hooks are enabled for the endpoint and returns the corresponding boolean value. Returns false if the Endpoint is nil.
type Environment ¶ added in v1.4.10
type Environment interface {
// GetSMTPBackendAddress returns the address of the SMTP backend server.
GetSMTPBackendAddress() string
// GetSMTPBackendPort returns the port of the SMTP backend server.
GetSMTPBackendPort() int
// GetIMAPBackendAddress returns the address of the IMAP backend server.
GetIMAPBackendAddress() string
// GetIMAPBackendPort returns the port of the IMAP backend server.
GetIMAPBackendPort() int
// GetPOP3BackendAddress returns the address of the POP3 backend server.
GetPOP3BackendAddress() string
// GetPOP3BackendPort returns the port of the POP3 backend server.
GetPOP3BackendPort() int
// GetWaitDelay returns the delay between connection attempts in seconds.
GetWaitDelay() uint8
// GetMaxLoginAttempts returns the maximum number of allowed login attempts.
GetMaxLoginAttempts() uint8
// GetDevMode indicates whether the application is in developer mode.
GetDevMode() bool
// GetMaxActionWorkers returns the maximum number of simultaneous action workers.
GetMaxActionWorkers() uint16
// GetLocalCacheAuthTTL returns the time-to-live duration for local cache authentication.
GetLocalCacheAuthTTL() time.Duration
}
Environment defines methods for accessing application configuration settings.
func GetEnvironment ¶ added in v1.4.10
func GetEnvironment() Environment
GetEnvironment returns the singleton instance of the environmentSettings configuration. Panics if the environment is uninitialized.
func NewEnvironmentConfig ¶ added in v1.4.10
func NewEnvironmentConfig() Environment
NewEnvironmentConfig initializes and returns a singleton instance of EnvironmentSettings, setting default and custom configurations.
func NewTestEnvironmentConfig ¶ added in v1.5.4
func NewTestEnvironmentConfig() Environment
NewTestEnvironmentConfig creates and returns a new instance of Environment with default settings.
type EnvironmentSettings ¶ added in v1.4.10
type EnvironmentSettings struct {
// SMTPBackendAddress is the address of the SMTP backend server.
SMTPBackendAddress string
// SMTPBackendPort is the port of the SMTP backend server.
SMTPBackendPort int
// IMAPBackendAddress is the address of the IMAP backend server.
IMAPBackendAddress string
// IMAPBackendPort is the port of the IMAP backend server.
IMAPBackendPort int
// POP3BackendAddress is the address of the POP3 backend server.
POP3BackendAddress string
// POP3BackendPort is the port of the IMAP POP3 server.
POP3BackendPort int
// WaitDelay is the time in seconds to wait between connection attempts.
WaitDelay uint8
// MaxLoginAttempts is the maximum number of login attempts.
MaxLoginAttempts uint8
// DevMode indicates whether the application is running in developer mode.
DevMode bool
// MaxActionWorkers is the maximum number of action workers that can be run simultaneously.
MaxActionWorkers uint16
// LocalCacheAuthTTL
LocalCacheAuthTTL time.Duration
}
EnvironmentSettings represents overall configuration settings for the application.
func (*EnvironmentSettings) GetDevMode ¶ added in v1.4.10
func (env *EnvironmentSettings) GetDevMode() bool
GetDevMode returns the DevMode value, indicating whether the application is running in developer mode.
func (*EnvironmentSettings) GetIMAPBackendAddress ¶ added in v1.4.10
func (env *EnvironmentSettings) GetIMAPBackendAddress() string
GetIMAPBackendAddress retrieves the address of the IMAP backend server from the EnvironmentSettings instance.
func (*EnvironmentSettings) GetIMAPBackendPort ¶ added in v1.4.10
func (env *EnvironmentSettings) GetIMAPBackendPort() int
GetIMAPBackendPort retrieves the port of the IMAP backend server from the EnvironmentSettings instance.
func (*EnvironmentSettings) GetLocalCacheAuthTTL ¶ added in v1.4.10
func (env *EnvironmentSettings) GetLocalCacheAuthTTL() time.Duration
GetLocalCacheAuthTTL retrieves the time-to-live duration for local cache authentication from the EnvironmentSettings instance.
func (*EnvironmentSettings) GetMaxActionWorkers ¶ added in v1.4.10
func (env *EnvironmentSettings) GetMaxActionWorkers() uint16
GetMaxActionWorkers retrieves the maximum number of action workers allowed from the EnvironmentSettings instance.
func (*EnvironmentSettings) GetMaxLoginAttempts ¶ added in v1.4.10
func (env *EnvironmentSettings) GetMaxLoginAttempts() uint8
GetMaxLoginAttempts retrieves the maximum allowed number of login attempts from the EnvironmentSettings instance.
func (*EnvironmentSettings) GetPOP3BackendAddress ¶ added in v1.4.10
func (env *EnvironmentSettings) GetPOP3BackendAddress() string
GetPOP3BackendAddress retrieves the address of the POP3 backend server from the EnvironmentSettings instance.
func (*EnvironmentSettings) GetPOP3BackendPort ¶ added in v1.4.10
func (env *EnvironmentSettings) GetPOP3BackendPort() int
GetPOP3BackendPort retrieves the port of the POP3 backend server from the EnvironmentSettings instance.
func (*EnvironmentSettings) GetSMTPBackendAddress ¶ added in v1.4.10
func (env *EnvironmentSettings) GetSMTPBackendAddress() string
GetSMTPBackendAddress retrieves the address of the SMTP backend server from the EnvironmentSettings instance.
func (*EnvironmentSettings) GetSMTPBackendPort ¶ added in v1.4.10
func (env *EnvironmentSettings) GetSMTPBackendPort() int
GetSMTPBackendPort retrieves the port of the SMTP backend server from the EnvironmentSettings instance.
func (*EnvironmentSettings) GetWaitDelay ¶ added in v1.4.10
func (env *EnvironmentSettings) GetWaitDelay() uint8
GetWaitDelay retrieves the wait delay in seconds between connection attempts from the EnvironmentSettings instance.
func (*EnvironmentSettings) String ¶ added in v1.4.10
func (env *EnvironmentSettings) String() string
String returns the name of the Config object excluding the HTTPOptions.
type Feature ¶
type Feature struct {
// contains filtered or unexported fields
}
Feature is a container for Nauthilus features.
func (*Feature) Set ¶
Set updates the feature name based on the provided value. It returns an error if the value is not a valid feature name. Valid feature names are "tls_encryption", "rbl", "relay_domains", and "lua". If the value is valid, the name field of the Feature struct is updated accordingly. An error of type ErrWrongFeature is returned if the value is not valid.
type File ¶
type File interface {
// HandleFile processes the configuration file.
HandleFile() error
// GetConfigFileAsJSON returns the configuration file contents as a JSON-formatted string. An error is returned if conversion fails.
GetConfigFileAsJSON() ([]byte, error)
// HaveLuaFeatures checks if Lua features are available.
HaveLuaFeatures() bool
// HaveLuaFilters checks if Lua filters are active.
HaveLuaFilters() bool
// HaveLuaActions checks if Lua actions are enabled.
HaveLuaActions() bool
// HaveLuaHooks checks if Lua hooks are being used.
HaveLuaHooks() bool
// HaveLuaInit checks if a Lua initialization script exists.
HaveLuaInit() bool
// HaveLua checks if Lua-based configuration in general is available.
HaveLua() bool
// HaveLuaBackend returns a boolean indicating whether a Lua backend is available in the current configuration.
HaveLuaBackend() bool
// GetLuaInitScriptPath returns the path to the Lua initialization script.
GetLuaInitScriptPath() string
// GetLuaInitScriptPaths returns all paths to Lua initialization scripts.
GetLuaInitScriptPaths() []string
// GetLuaPackagePath retrieves the Lua package path from the configuration.
GetLuaPackagePath() string
// GetLuaNumberOfWorkers returns the number of Lua workers configured for handling Lua scripts.
GetLuaNumberOfWorkers() int
// GetLuaScriptPath returns the path to the Lua script.
GetLuaScriptPath() string
// GetLuaSearchProtocol retrieves the Lua search protocol for a given protocol name.
GetLuaSearchProtocol(protocol string, backendName string) (*LuaSearchProtocol, error)
// GetLuaOptionalBackends retrieves a map of Lua configurations for optional backends, indexed by their names.
GetLuaOptionalBackends() map[string]*LuaConf
// HaveLDAPBackend checks if an LDAP backend is being used.
HaveLDAPBackend() bool
// LDAPHavePoolOnly checks whether LDAP connections are only handled via a pool.
LDAPHavePoolOnly(backendName string) bool
// GetLDAPConfigLookupPoolSize returns the pool size for LDAP lookups.
GetLDAPConfigLookupPoolSize() int
// GetLDAPConfigAuthPoolSize returns the pool size for LDAP authentication.
GetLDAPConfigAuthPoolSize() int
// GetLDAPConfigConnectAbortTimeout retrieves the timeout duration for aborting LDAP connect attempts.
GetLDAPConfigConnectAbortTimeout() time.Duration
// GetLDAPConfigLookupIdlePoolSize retrieves the idle pool size for LDAP lookups.
GetLDAPConfigLookupIdlePoolSize() int
// GetLDAPConfigAuthIdlePoolSize retrieves the idle pool size for LDAP authentication.
GetLDAPConfigAuthIdlePoolSize() int
// GetLDAPConfigBindDN returns the Bind DN for LDAP.
GetLDAPConfigBindDN() string
// GetLDAPConfigBindPW retrieves the password for the LDAP bind.
GetLDAPConfigBindPW() string
// GetLDAPConfigTLSCAFile returns the TLS CA file for LDAP.
GetLDAPConfigTLSCAFile() string
// GetLDAPConfigTLSClientCert retrieves the TLS client certificate for LDAP.
GetLDAPConfigTLSClientCert() string
// GetLDAPConfigTLSClientKey returns the TLS client key for LDAP.
GetLDAPConfigTLSClientKey() string
// GetLDAPConfigNumberOfWorkers returns the configured number of worker threads for LDAP processing.
GetLDAPConfigNumberOfWorkers() int
// GetLDAPConfigServerURIs retrieves a list of LDAP server URIs.
GetLDAPConfigServerURIs() []string
// GetLDAPConfigStartTLS indicates if StartTLS is enabled for LDAP.
GetLDAPConfigStartTLS() bool
// GetLDAPConfigTLSSkipVerify checks whether TLS verification for LDAP is skipped.
GetLDAPConfigTLSSkipVerify() bool
// GetLDAPConfigSASLExternal checks if SASL External is configured for LDAP.
GetLDAPConfigSASLExternal() bool
// GetLDAPSearchProtocol retrieves the LDAP search protocol for a given protocol name.
GetLDAPSearchProtocol(protocol string, poolName string) (*LDAPSearchProtocol, error)
// GetLDAPOptionalPools returns a map of optional LDAP pool configurations, indexed by their respective keys.
GetLDAPOptionalPools() map[string]*LDAPConf
// GetBackendServers returns a list of backend servers.
GetBackendServers() []*BackendServer
// GetBackendServerMonitoring provides the configuration and status of server monitoring.
GetBackendServerMonitoring() *BackendServerMonitoring
// HasFeature checks whether a specific feature is available.
HasFeature(feature string) bool
// GetClientHost returns the client's hostname.
GetClientHost() string
// GetOIDCCID returns the OpenID Connect Client ID as a string.
GetOIDCCID() string
// GetClientIP retrieves the client's IP address.
GetClientIP() string
// GetClientPort returns the client's port.
GetClientPort() string
// GetClientID retrieves the client's ID.
GetClientID() string
// GetUsername returns the username of the currently authenticated user.
GetUsername() string
// GetPassword retrieves the user's password.
GetPassword() string
// GetPasswordEncoded returns the encoded password.
GetPasswordEncoded() string
// GetLoginAttempt retrieves the current login attempt.
GetLoginAttempt() string
// GetAuthMethod provides the authentication method used.
GetAuthMethod() string
// GetSkipTOTP checks if TOTP (Two-Factor Authentication) is skipped.
GetSkipTOTP(string) bool
// GetSkipConsent checks if consent is skipped.
GetSkipConsent(string) bool
// GetLocalIP returns the local IP address.
GetLocalIP() string
// GetLocalPort retrieves the local port.
GetLocalPort() string
// GetProtocol returns the protocol as a string, typically used to retrieve and determine the communication protocol in use.
GetProtocol() string
// GetAllProtocols returns all available protocols.
GetAllProtocols() []string
// GetBruteForceRules retrieves the brute force protection rules.
GetBruteForceRules() []BruteForceRule
// GetServer retrieves the server section of the configuration.
GetServer() *ServerSection
// GetRBLs retrieves the Realtime Block Lists (RBL).
GetRBLs() *RBLSection
// GetClearTextList returns a list of clear-text entries configured for the application.
GetClearTextList() []string
// GetRelayDomains retrieves the relay domains configuration section of the file.
GetRelayDomains() *RelayDomainsSection
// GetBruteForce retrieves the BruteForceSection configuration, containing brute force protection rules and settings.
GetBruteForce() *BruteForceSection
// GetLua retrieves the LuaSection from the configuration, containing actions, features, filters, hooks, and related config.
GetLua() *LuaSection
// GetOauth2 retrieves the Oauth2Section configuration, containing custom scopes and clients for OAuth2 authentication.
GetOauth2() *Oauth2Section
// GetLDAP returns the LDAPSection object containing configuration and search definitions for LDAP operations.
GetLDAP() *LDAPSection
}
File represents an interface encapsulating various methods for configuration, file handling, and related operations.
type FileSettings ¶ added in v1.4.10
type FileSettings struct {
Server *ServerSection `mapstructure:"server" valdiate:"required"`
RBLs *RBLSection `mapstructure:"realtime_blackhole_lists" valdiate:"omitempty"`
ClearTextList []string `mapstructure:"cleartext_networks" valdiate:"omitempty,dive"`
RelayDomains *RelayDomainsSection `mapstructure:"relay_domains" valdiate:"omitempty"`
BackendServerMonitoring *BackendServerMonitoring `mapstructure:"backend_server_monitoring" valdiate:"omitempty"`
BruteForce *BruteForceSection `mapstructure:"brute_force" valdiate:"omitempty"`
Lua *LuaSection `mapstructure:"lua" valdiate:"omitempty"`
LDAP *LDAPSection `mapstructure:"ldap" valdiate:"omitempty"`
Oauth2 *Oauth2Section `mapstructure:"oauth2" valdiate:"omitempty"`
Other map[string]any `mapstructure:",remain"`
Mu sync.Mutex
}
FileSettings represents a comprehensive configuration structure utilized to manage server settings, blackhole lists, brute force, Lua scripting, OAuth2, LDAP, and other miscellaneous configurations. It includes synchronization via a mutex.
func (*FileSettings) GetAllProtocols ¶ added in v1.4.10
func (f *FileSettings) GetAllProtocols() []string
GetAllProtocols returns a unique slice of strings (a Set) for all defined protocols in the database search sections. Returns an empty slice if the FileSettings is nil.
func (*FileSettings) GetAuthMethod ¶ added in v1.4.10
func (f *FileSettings) GetAuthMethod() string
GetAuthMethod returns the HTTP request header for the auth mechanism LOGIN or PLAIN
func (*FileSettings) GetBackendServer ¶ added in v1.4.10
func (f *FileSettings) GetBackendServer(protocol string) *BackendServer
GetBackendServer retrieves the first BackendServer that matches the specified protocol from the FileSettings's backend servers. Returns an empty BackendServer if no matching server is found or if the FileSettings object is nil.
func (*FileSettings) GetBackendServerMonitoring ¶ added in v1.4.10
func (f *FileSettings) GetBackendServerMonitoring() *BackendServerMonitoring
GetBackendServerMonitoring is a method on the FileSettings struct. It returns the BackendServerMonitoring field from the FileSettings struct. Returns an empty BackendServerMonitoring if the FileSettings is nil or if the BackendServerMonitoring field is nil.
func (*FileSettings) GetBackendServers ¶ added in v1.4.10
func (f *FileSettings) GetBackendServers() []*BackendServer
GetBackendServers retrieves the list of backend servers for the FileSettings instance or returns an empty list if none are configured.
func (*FileSettings) GetBruteForce ¶ added in v1.4.10
func (f *FileSettings) GetBruteForce() *BruteForceSection
GetBruteForce returns the BruteForceSection associated with the FileSettings instance. Returns nil if the instance is nil.
func (*FileSettings) GetBruteForceRules ¶ added in v1.4.10
func (f *FileSettings) GetBruteForceRules() []BruteForceRule
GetBruteForceRules retrieves the list of brute force rules defined in the configuration file. If no rules are defined or the FileSettings instance is nil, it returns an empty slice.
func (*FileSettings) GetClearTextList ¶ added in v1.4.10
func (f *FileSettings) GetClearTextList() []string
GetClearTextList retrieves a list of clear text strings from the FileSettings instance. Returns nil if the FileSettings instance is nil.
func (*FileSettings) GetClientHost ¶ added in v1.4.10
func (f *FileSettings) GetClientHost() string
GetClientHost returns the HTTP request header used to retrieve an optional client hostname
func (*FileSettings) GetClientID ¶ added in v1.4.10
func (f *FileSettings) GetClientID() string
GetClientID returns the HTTP request header used to retrieve an optional client ID
func (*FileSettings) GetClientIP ¶ added in v1.4.10
func (f *FileSettings) GetClientIP() string
GetClientIP returns the HTTP request header that holds the client IP of the request
func (*FileSettings) GetClientPort ¶ added in v1.4.10
func (f *FileSettings) GetClientPort() string
GetClientPort returns the HTTP request header that holds the client TCP port of the request
func (*FileSettings) GetConfig ¶ added in v1.4.10
func (f *FileSettings) GetConfig(backend definitions.Backend) any
GetConfig retrieves the configuration for a given backend from the FileSettings receiver or returns nil if unavailable.
func (*FileSettings) GetConfigFileAsJSON ¶ added in v1.7.11
func (f *FileSettings) GetConfigFileAsJSON() ([]byte, error)
GetConfigFileAsJSON returns the current configuration settings as a JSON string, ensuring thread safety with a mutex lock.
func (*FileSettings) GetLDAP ¶ added in v1.4.10
func (f *FileSettings) GetLDAP() *LDAPSection
GetLDAP retrieves the LDAPSection from the FileSettings instance. Returns nil if the FileSettings is nil.
func (*FileSettings) GetLDAPConfigAuthIdlePoolSize ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigAuthIdlePoolSize() int
GetLDAPConfigAuthIdlePoolSize retrieves the authentication idle pool size for the LDAP configuration. It returns the default value if the configuration is nil or not properly set.
func (*FileSettings) GetLDAPConfigAuthPoolSize ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigAuthPoolSize() int
GetLDAPConfigAuthPoolSize returns the authentication pool size configured for an LDAP backend or a default value if not set.
func (*FileSettings) GetLDAPConfigBindDN ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigBindDN() string
GetLDAPConfigBindDN returns the BindDN value from the LDAP configuration if available, otherwise it returns an empty string.
func (*FileSettings) GetLDAPConfigBindPW ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigBindPW() string
GetLDAPConfigBindPW retrieves the BindPW (bind password) from the LDAP configuration if available, or returns an empty string.
func (*FileSettings) GetLDAPConfigConnectAbortTimeout ¶ added in v1.5.0
func (f *FileSettings) GetLDAPConfigConnectAbortTimeout() time.Duration
GetLDAPConfigConnectAbortTimeout retrieves the abort timeout duration from the LDAP configuration, or returns 0 if not applicable.
func (*FileSettings) GetLDAPConfigLookupIdlePoolSize ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigLookupIdlePoolSize() int
GetLDAPConfigLookupIdlePoolSize returns the configured idle connection pool size for LDAP lookups or a default value if unset.
func (*FileSettings) GetLDAPConfigLookupPoolSize ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigLookupPoolSize() int
GetLDAPConfigLookupPoolSize returns the size of the LDAP lookup connection pool, or a default if no configuration exists.
func (*FileSettings) GetLDAPConfigNumberOfWorkers ¶ added in v1.6.5
func (f *FileSettings) GetLDAPConfigNumberOfWorkers() int
GetLDAPConfigNumberOfWorkers retrieves the number of workers for the LDAP configuration. Defaults to a predefined value.
func (*FileSettings) GetLDAPConfigSASLExternal ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigSASLExternal() bool
GetLDAPConfigSASLExternal checks if the LDAP configuration uses SASL External authentication and returns its status. It returns false if the FileSettings receiver or the LDAP configuration is nil, or if the type assertion fails.
func (*FileSettings) GetLDAPConfigServerURIs ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigServerURIs() []string
GetLDAPConfigServerURIs retrieves the LDAP server URIs from the configuration or returns "ldap://localhost" as a default value.
func (*FileSettings) GetLDAPConfigStartTLS ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigStartTLS() bool
GetLDAPConfigStartTLS determines if StartTLS is enabled for the LDAP configuration in the provided file. Returns false if the file or configuration is nil or not of type *LDAPConf.
func (*FileSettings) GetLDAPConfigTLSCAFile ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigTLSCAFile() string
GetLDAPConfigTLSCAFile retrieves the TLS CA file for the LDAP configuration if available, returning an empty string if not.
func (*FileSettings) GetLDAPConfigTLSClientCert ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigTLSClientCert() string
GetLDAPConfigTLSClientCert retrieves the TLS client certificate for the LDAP configuration. Returns an empty string if the file or configuration is nil, or if the assertion of the config type fails.
func (*FileSettings) GetLDAPConfigTLSClientKey ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigTLSClientKey() string
GetLDAPConfigTLSClientKey retrieves the TLS client key for the LDAP configuration. Returns an empty string if not set.
func (*FileSettings) GetLDAPConfigTLSSkipVerify ¶ added in v1.4.10
func (f *FileSettings) GetLDAPConfigTLSSkipVerify() bool
GetLDAPConfigTLSSkipVerify retrieves the TLSSkipVerify value from the LDAP configuration in the file. Returns false if the file or configuration is nil or not of type *LDAPConf.
func (*FileSettings) GetLDAPOptionalPools ¶ added in v1.5.0
func (f *FileSettings) GetLDAPOptionalPools() map[string]*LDAPConf
GetLDAPOptionalPools retrieves a map of optional LDAP pool configurations from the file settings. Returns an empty map if the file settings or LDAP section is not properly configured.
func (*FileSettings) GetLDAPSearchProtocol ¶ added in v1.4.10
func (f *FileSettings) GetLDAPSearchProtocol(protocol string, poolName string) (*LDAPSearchProtocol, error)
GetLDAPSearchProtocol retrieves the LDAPSearchProtocol configuration based on the specified protocol. If the protocol is not found, it falls back to the default protocol. Returns an error if the configuration or default protocol is missing. Returns nil if no matching protocol is found and there's no error.
func (*FileSettings) GetLocalIP ¶ added in v1.4.10
func (f *FileSettings) GetLocalIP() string
GetLocalIP returns the HTTP request header that represents the local IP address for the server that accepts client requests
func (*FileSettings) GetLocalPort ¶ added in v1.4.10
func (f *FileSettings) GetLocalPort() string
GetLocalPort returns the HTTP request header that represents the local TCP port for the server that accepts client requests
func (*FileSettings) GetLoginAttempt ¶ added in v1.4.10
func (f *FileSettings) GetLoginAttempt() string
GetLoginAttempt returns the HTTP request header for login-attempts
func (*FileSettings) GetLua ¶ added in v1.4.10
func (f *FileSettings) GetLua() *LuaSection
GetLua retrieves the LuaSection from the FileSettings instance. Returns nil if the FileSettings instance is nil.
func (*FileSettings) GetLuaInitScriptPath ¶ added in v1.4.10
func (f *FileSettings) GetLuaInitScriptPath() string
GetLuaInitScriptPath returns the path to the Lua init script specified in the configuration. If the configuration or LuaConf is nil, it returns an empty string. If InitScriptPaths is set, it returns the first path from that list. Otherwise, it returns the value of InitScriptPath.
func (*FileSettings) GetLuaInitScriptPaths ¶ added in v1.7.7
func (f *FileSettings) GetLuaInitScriptPaths() []string
GetLuaInitScriptPaths returns all paths to Lua init scripts specified in the configuration. It combines both the single InitScriptPath and the list in InitScriptPaths. If the configuration or LuaConf is nil, it returns an empty slice.
func (*FileSettings) GetLuaNumberOfWorkers ¶ added in v1.6.5
func (f *FileSettings) GetLuaNumberOfWorkers() int
GetLuaNumberOfWorkers retrieves the number of workers configured for the Lua backend or returns the default if unset.
func (*FileSettings) GetLuaOptionalBackends ¶ added in v1.5.0
func (f *FileSettings) GetLuaOptionalBackends() map[string]*LuaConf
GetLuaOptionalBackends retrieves the optional Lua backends configuration from FileSettings. Returns an empty map if unavailable.
func (*FileSettings) GetLuaPackagePath ¶ added in v1.4.10
func (f *FileSettings) GetLuaPackagePath() string
GetLuaPackagePath returns the Lua package path based on the file configuration or a default path if not specified.
func (*FileSettings) GetLuaScriptPath ¶ added in v1.4.10
func (f *FileSettings) GetLuaScriptPath() string
GetLuaScriptPath retrieves the backend Lua script file path from the configuration. Returns an empty string if unavailable.
func (*FileSettings) GetLuaSearchProtocol ¶ added in v1.4.10
func (f *FileSettings) GetLuaSearchProtocol(protocol string, backendName string) (*LuaSearchProtocol, error)
GetLuaSearchProtocol retrieves a LuaSearchProtocol configuration matching the specified protocol. Returns a default LuaSearchProtocol if the protocol cannot be found and protocol is set to ProtoDefault. Returns a DetailedError if the protocol cannot be found and no default is configured. Returns nil if no matching protocol is found and there's no error. Accepts a string representing the protocol to search for.
func (*FileSettings) GetOIDCCID ¶ added in v1.7.5
func (f *FileSettings) GetOIDCCID() string
GetOIDCCID retrieves the OIDC Client ID from the FileSettings' DefaultHTTPRequestHeader. Returns an empty string if nil.
func (*FileSettings) GetOauth2 ¶ added in v1.4.10
func (f *FileSettings) GetOauth2() *Oauth2Section
GetOauth2 returns the Oauth2Section of the FileSettings instance. Returns nil if the FileSettings instance is nil.
func (*FileSettings) GetPassword ¶ added in v1.4.10
func (f *FileSettings) GetPassword() string
GetPassword returns the HTTP request header for the password
func (*FileSettings) GetPasswordEncoded ¶ added in v1.4.10
func (f *FileSettings) GetPasswordEncoded() string
GetPasswordEncoded returns the HTTP request header to indicate if the password was encoded
func (*FileSettings) GetProtocol ¶ added in v1.4.10
func (f *FileSettings) GetProtocol() string
GetProtocol returns the HTTP request header for the used protocol
func (*FileSettings) GetProtocols ¶ added in v1.4.10
func (f *FileSettings) GetProtocols(backend definitions.Backend) any
GetProtocols retrieves protocol configurations for the specified backend type. Returns nil if the backend is not found or has no associated protocols.
func (*FileSettings) GetRBLs ¶ added in v1.4.10
func (f *FileSettings) GetRBLs() *RBLSection
GetRBLs retrieves the RBLSection configuration from the FileSettings instance. Returns nil if the FileSettings instance is nil.
func (*FileSettings) GetRelayDomains ¶ added in v1.4.10
func (f *FileSettings) GetRelayDomains() *RelayDomainsSection
GetRelayDomains retrieves the RelayDomainsSection from the FileSettings. Returns nil if the FileSettings is nil.
func (*FileSettings) GetSSL ¶ added in v1.4.10
func (f *FileSettings) GetSSL() string
GetSSL returns the HTTP request header used to indicate SSL security for the current client connection
func (*FileSettings) GetSSLCipher ¶ added in v1.4.10
func (f *FileSettings) GetSSLCipher() string
GetSSLCipher retrieves the SSL cipher from the default HTTP request header of the server configuration. Returns an empty string if the FileSettings instance is nil.
func (*FileSettings) GetSSLClientCN ¶ added in v1.4.10
func (f *FileSettings) GetSSLClientCN() string
GetSSLClientCN retrieves the SSL client common name (CN) from the default HTTP request header.
func (*FileSettings) GetSSLClientIssuerDN ¶ added in v1.4.10
func (f *FileSettings) GetSSLClientIssuerDN() string
GetSSLClientIssuerDN returns the distinguished name (DN) of the SSL client issuer from the default HTTP request header.
func (*FileSettings) GetSSLClientNotAfter ¶ added in v1.4.10
func (f *FileSettings) GetSSLClientNotAfter() string
GetSSLClientNotAfter retrieves the SSL client certificate's "not after" expiration date as a string. Returns an empty string if the FileSettings is nil.
func (*FileSettings) GetSSLClientNotBefore ¶ added in v1.4.10
func (f *FileSettings) GetSSLClientNotBefore() string
GetSSLClientNotBefore retrieves the "SSLClientNotBefore" value from the default HTTP request header of the server. Returns an empty string if the FileSettings instance is nil.
func (*FileSettings) GetSSLClientSubjectDN ¶ added in v1.4.10
func (f *FileSettings) GetSSLClientSubjectDN() string
GetSSLClientSubjectDN returns the SSL client subject distinguished name from the default HTTP request header. If the FileSettings receiver is nil, it returns an empty string.
func (*FileSettings) GetSSLFingerprint ¶ added in v1.4.10
func (f *FileSettings) GetSSLFingerprint() string
GetSSLFingerprint retrieves the SSL fingerprint from the server's default HTTP request header. If the FileSettings is nil, it returns an empty string.
func (*FileSettings) GetSSLIssuer ¶ added in v1.4.10
func (f *FileSettings) GetSSLIssuer() string
GetSSLIssuer retrieves the SSL certificate issuer from the default HTTP request header of the server configuration.
func (*FileSettings) GetSSLIssuerDN ¶ added in v1.4.10
func (f *FileSettings) GetSSLIssuerDN() string
GetSSLIssuerDN retrieves the Distinguished Name (DN) of the SSL issuer from the default HTTP request header.
func (*FileSettings) GetSSLProtocol ¶ added in v1.4.10
func (f *FileSettings) GetSSLProtocol() string
GetSSLProtocol retrieves the SSL protocol from the DefaultHTTPRequestHeader of the Server configuration.
func (*FileSettings) GetSSLSerial ¶ added in v1.4.10
func (f *FileSettings) GetSSLSerial() string
GetSSLSerial retrieves the SSL serial number from the default HTTP request header of the server configuration. Returns an empty string if the FileSettings receiver is nil.
func (*FileSettings) GetSSLSessionID ¶ added in v1.4.10
func (f *FileSettings) GetSSLSessionID() string
GetSSLSessionID retrieves the SSL session ID from the file's default HTTP request header. Returns an empty string if the file is nil.
func (*FileSettings) GetSSLSubject ¶ added in v1.4.10
func (f *FileSettings) GetSSLSubject() string
GetSSLSubject retrieves the SSL subject from the default HTTP request header. Returns an empty string if the file is nil.
func (*FileSettings) GetSSLSubjectDN ¶ added in v1.4.10
func (f *FileSettings) GetSSLSubjectDN() string
GetSSLSubjectDN returns the SSL subject distinguished name from the Server's default HTTP request header.
func (*FileSettings) GetSSLVerify ¶ added in v1.4.10
func (f *FileSettings) GetSSLVerify() string
GetSSLVerify retrieves the SSL verification status from the default HTTP request header configuration. If the FileSettings receiver is nil, it returns an empty string.
func (*FileSettings) GetSection ¶ added in v1.4.10
func (f *FileSettings) GetSection(backend definitions.Backend) any
GetSection retrieves the section corresponding to the provided backend type from the FileSettings. Returns nil if not found.
func (*FileSettings) GetServer ¶ added in v1.4.10
func (f *FileSettings) GetServer() *ServerSection
GetServer retrieves the ServerSection from the FileSettings. Returns an empty ServerSection if the FileSettings is nil or if no Server is present.
func (*FileSettings) GetSkipConsent ¶ added in v1.4.10
func (f *FileSettings) GetSkipConsent(clientId string) (skip bool)
GetSkipConsent returns a boolean true, if the consent dialog shall be skipped for an OAuth-2 client.
func (*FileSettings) GetSkipTOTP ¶ added in v1.4.10
func (f *FileSettings) GetSkipTOTP(clientId string) (skip bool)
GetSkipTOTP returns a boolean true, if TOTP two-factor authentication shall be skipped for an OAuth-2 client.
func (*FileSettings) GetUsername ¶ added in v1.4.10
func (f *FileSettings) GetUsername() string
GetUsername returns the HTTP request header for the username
func (*FileSettings) HandleFile ¶ added in v1.4.10
func (f *FileSettings) HandleFile() (err error)
HandleFile applies the configuration settings loaded from the configuration file. It does sanity checks to make sure Nauthilus has a working configuration.
func (*FileSettings) HasFeature ¶ added in v1.4.10
func (f *FileSettings) HasFeature(feature string) bool
HasFeature checks if the given feature exists in the LoadableConfig's Features list
func (*FileSettings) HaveLDAPBackend ¶ added in v1.4.10
func (f *FileSettings) HaveLDAPBackend() bool
HaveLDAPBackend checks if the configuration includes an LDAP backend and returns true if it exists, otherwise false.
func (*FileSettings) HaveLua ¶ added in v1.4.10
func (f *FileSettings) HaveLua() bool
HaveLua is a method on the FileSettings struct. It checks if the Lua field in the FileSettings struct is not nil. It returns a boolean value indicating whether Lua is present or not.
func (*FileSettings) HaveLuaActions ¶ added in v1.4.10
func (f *FileSettings) HaveLuaActions() bool
HaveLuaActions is a method on the FileSettings struct. It checks if the FileSettings struct has Lua actions. It returns true if the FileSettings struct has Lua actions, otherwise returns false.
func (*FileSettings) HaveLuaBackend ¶ added in v1.6.9
func (f *FileSettings) HaveLuaBackend() bool
HaveLuaBackend checks if the FileSettings instance has a Lua backend configured and returns true if found, otherwise false.
func (*FileSettings) HaveLuaFeatures ¶ added in v1.4.10
func (f *FileSettings) HaveLuaFeatures() bool
HaveLuaFeatures is a method on the FileSettings struct. It checks if the FileSettings struct has Lua features. It returns true if there are Lua features, and false otherwise.
func (*FileSettings) HaveLuaFilters ¶ added in v1.4.10
func (f *FileSettings) HaveLuaFilters() bool
HaveLuaFilters is a method on the FileSettings struct. It checks if the FileSettings struct has Lua filters. It returns true if there are Lua filters, and false otherwise.
func (*FileSettings) HaveLuaHooks ¶ added in v1.4.10
func (f *FileSettings) HaveLuaHooks() bool
HaveLuaHooks returns true if the FileSettings instance has Lua hooks associated with it, otherwise returns false.
func (*FileSettings) HaveLuaInit ¶ added in v1.4.10
func (f *FileSettings) HaveLuaInit() bool
HaveLuaInit checks if any Lua initialization script paths are set in the configuration. It first confirms that the FileSettings instance supports Lua by invoking HaveLua method. Then, it retrieves the Lua configuration using GetConfig with the definitions.BackendLua constant. If the retrieved configuration is of type *LuaConf and either InitScriptPath is not empty or InitScriptPaths contains at least one entry, it returns true. Otherwise, it returns false.
func (*FileSettings) HaveServer ¶ added in v1.4.10
func (f *FileSettings) HaveServer() bool
HaveServer is a method on the FileSettings struct. It returns true if the Server field in the FileSettings struct is not nil, indicating that a server exists.
func (*FileSettings) LDAPHavePoolOnly ¶ added in v1.4.10
func (f *FileSettings) LDAPHavePoolOnly(backendName string) bool
LDAPHavePoolOnly checks if the LDAP configuration is set to use the `PoolOnly` mode. Returns false if any element is nil.
func (*FileSettings) RetrieveGetterMap ¶ added in v1.4.10
func (f *FileSettings) RetrieveGetterMap() map[definitions.Backend]GetterHandler
RetrieveGetterMap returns a map associating each supported backend with its corresponding GetterHandler implementation. This method initializes a new map for the backends, and populates it by checking if certain backend sections exist. If the provided FileSettings object is nil, it returns an empty map.
type Frontend ¶ added in v1.1.0
type Frontend struct {
Enabled bool `mapstructure:"enabled"`
CSRFSecret string `mapstructure:"csrf_secret" validate:"omitempty,len=32,alphanumsymbol,excludesall= "`
CookieStoreAuthKey string `mapstructure:"cookie_store_auth_key" validate:"omitempty,len=32,alphanumsymbol,excludesall= "`
CookieStoreEncKey string `mapstructure:"cookie_store_encryption_key" validate:"omitempty,alphanumsymbol,excludesall= ,validateCookieStoreEncKey"`
}
Frontend represents configuration options for the frontend of the application.
func (*Frontend) GetCSRFSecret ¶ added in v1.7.7
GetCSRFSecret retrieves the CSRF secret from the Frontend configuration. Returns an empty string if the Frontend is nil.
func (*Frontend) GetCookieStoreAuthKey ¶ added in v1.7.7
GetCookieStoreAuthKey retrieves the cookie store authentication key from the Frontend configuration. Returns an empty string if the Frontend is nil.
func (*Frontend) GetCookieStoreEncKey ¶ added in v1.7.7
GetCookieStoreEncKey retrieves the cookie store encryption key from the Frontend configuration. Returns an empty string if the Frontend is nil.
type GetterHandler ¶
type GetterHandler interface {
// GetConfig retrieves the configuration associated with the implementing object or returns nil if unavailable.
GetConfig() any
// GetProtocols retrieves protocol configurations associated with the implementing object or returns nil if unavailable.
GetProtocols() any
}
GetterHandler is an interface that provides methods to retrieve configuration and protocol information.
type HTTPClient ¶ added in v1.3.0
type HTTPClient struct {
MaxConnsPerHost int `mapstructure:"max_connections_per_host" validate:"omitempty,gte=1"`
MaxIdleConns int `mapstructure:"max_idle_connections" validate:"omitempty,gte=1"`
MaxIdleConnsPerHost int `mapstructure:"max_idle_connections_per_host" validate:"omitempty,gte=0"`
IdleConnTimeout time.Duration `mapstructure:"idle_connection_timeout" validate:"omitempty,gte=0"`
Proxy string `mapstructure:"proxy"`
TLS TLS `mapstructure:"tls"`
}
func (*HTTPClient) GetIdleConnTimeout ¶ added in v1.4.11
func (c *HTTPClient) GetIdleConnTimeout() time.Duration
GetIdleConnTimeout returns the idle connection timeout duration configured for the HTTP client. Returns 0 if the HTTPClient is nil.
func (*HTTPClient) GetMaxConnsPerHost ¶ added in v1.4.11
func (c *HTTPClient) GetMaxConnsPerHost() int
GetMaxConnsPerHost returns the maximum number of connections allowed per host for the HTTP client. Returns 0 if the HTTPClient is nil.
func (*HTTPClient) GetMaxIdleConns ¶ added in v1.4.11
func (c *HTTPClient) GetMaxIdleConns() int
GetMaxIdleConns returns the maximum number of idle connections allowed for the HTTP client. Returns 0 if the HTTPClient is nil.
func (*HTTPClient) GetMaxIdleConnsPerHost ¶ added in v1.4.11
func (c *HTTPClient) GetMaxIdleConnsPerHost() int
GetMaxIdleConnsPerHost returns the maximum number of idle connections allowed per host for the HTTP client. Returns 0 if the HTTPClient is nil.
func (*HTTPClient) GetProxy ¶ added in v1.4.11
func (c *HTTPClient) GetProxy() string
GetProxy returns the proxy URL configured for the HTTP client. Returns an empty string if the HTTPClient is nil.
func (*HTTPClient) GetTLS ¶ added in v1.7.11
func (c *HTTPClient) GetTLS() *TLS
GetTLS returns the TLS configuration associated with the HTTP client. Returns an empty TLS struct if the receiver is nil.
type IdTokenClaims ¶
type IdTokenClaims struct {
// Scope: profile.
Name string `mapstructure:"name" validate:"omitempty,printascii,excludesall= "`
GivenName string `mapstructure:"given_name" validate:"omitempty,printascii,excludesall= "`
FamilyName string `mapstructure:"family_name" validate:"omitempty,printascii,excludesall= "`
MiddleName string `mapstructure:"middle_name" validate:"omitempty,printascii,excludesall= "`
NickName string `mapstructure:"nickname" validate:"omitempty,printascii,excludesall= "`
PreferredUserName string `mapstructure:"preferred_username" validate:"omitempty,printascii,excludesall= "`
Profile string `mapstructure:"profile" validate:"omitempty,printascii,excludesall= "`
Website string `mapstructure:"website" validate:"omitempty,printascii,excludesall= "`
Picture string `mapstructure:"picture" validate:"omitempty,printascii,excludesall= "`
Gender string `mapstructure:"gender" validate:"omitempty,printascii,excludesall= "`
Birthdate string `mapstructure:"birthdate" validate:"omitempty,printascii,excludesall= "`
ZoneInfo string `mapstructure:"zoneinfo" validate:"omitempty,printascii,excludesall= "`
Locale string `mapstructure:"locale" validate:"omitempty,printascii,excludesall= "`
UpdatedAt string `mapstructure:"updated_at" validate:"omitempty,printascii,excludesall= "`
// Scope: email.
Email string `mapstructure:"email" validate:"omitempty,printascii,excludesall= "`
EmailVerified string `mapstructure:"email_verified" validate:"omitempty,printascii,excludesall= "`
// Scope: phone.
PhoneNumber string `mapstructure:"phone_number" validate:"omitempty,printascii,excludesall= "`
PhoneNumberVerified string `mapstructure:"phone_number_verified" validate:"omitempty,printascii,excludesall= "`
// Scope: address.
Address string `mapstructure:"address" validate:"omitempty,printascii,excludesall= "`
// Scope: groups.
Groups string `mapstructure:"groups" validate:"omitempty,printascii,excludesall= "`
// Scope: user defined.
CustomClaims map[string]any `mapstructure:",remain"`
}
func (*IdTokenClaims) GetAddress ¶ added in v1.7.7
func (i *IdTokenClaims) GetAddress() string
GetAddress retrieves the address claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetBirthdate ¶ added in v1.7.7
func (i *IdTokenClaims) GetBirthdate() string
GetBirthdate retrieves the birthdate claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetCustomClaims ¶ added in v1.7.7
func (i *IdTokenClaims) GetCustomClaims() map[string]any
GetCustomClaims retrieves the custom claims from the IdTokenClaims. Returns nil if the IdTokenClaims is nil.
func (*IdTokenClaims) GetEmail ¶ added in v1.7.7
func (i *IdTokenClaims) GetEmail() string
GetEmail retrieves the email claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetEmailVerified ¶ added in v1.7.7
func (i *IdTokenClaims) GetEmailVerified() string
GetEmailVerified retrieves the email_verified claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetFamilyName ¶ added in v1.7.7
func (i *IdTokenClaims) GetFamilyName() string
GetFamilyName retrieves the family name claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetGender ¶ added in v1.7.7
func (i *IdTokenClaims) GetGender() string
GetGender retrieves the gender claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetGivenName ¶ added in v1.7.7
func (i *IdTokenClaims) GetGivenName() string
GetGivenName retrieves the given name claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetGroups ¶ added in v1.7.7
func (i *IdTokenClaims) GetGroups() string
GetGroups retrieves the groups claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetLocale ¶ added in v1.7.7
func (i *IdTokenClaims) GetLocale() string
GetLocale retrieves the locale claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetMiddleName ¶ added in v1.7.7
func (i *IdTokenClaims) GetMiddleName() string
GetMiddleName retrieves the middle name claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetName ¶ added in v1.7.7
func (i *IdTokenClaims) GetName() string
GetName retrieves the name claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetNickName ¶ added in v1.7.7
func (i *IdTokenClaims) GetNickName() string
GetNickName retrieves the nickname claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetPhoneNumber ¶ added in v1.7.7
func (i *IdTokenClaims) GetPhoneNumber() string
GetPhoneNumber retrieves the phone_number claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetPhoneNumberVerified ¶ added in v1.7.7
func (i *IdTokenClaims) GetPhoneNumberVerified() string
GetPhoneNumberVerified retrieves the phone_number_verified claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetPicture ¶ added in v1.7.7
func (i *IdTokenClaims) GetPicture() string
GetPicture retrieves the picture claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetPreferredUserName ¶ added in v1.7.7
func (i *IdTokenClaims) GetPreferredUserName() string
GetPreferredUserName retrieves the preferred username claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetProfile ¶ added in v1.7.7
func (i *IdTokenClaims) GetProfile() string
GetProfile retrieves the profile claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetUpdatedAt ¶ added in v1.7.7
func (i *IdTokenClaims) GetUpdatedAt() string
GetUpdatedAt retrieves the updated_at claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetWebsite ¶ added in v1.7.7
func (i *IdTokenClaims) GetWebsite() string
GetWebsite retrieves the website claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) GetZoneInfo ¶ added in v1.7.7
func (i *IdTokenClaims) GetZoneInfo() string
GetZoneInfo retrieves the zoneinfo claim from the IdTokenClaims. Returns an empty string if the IdTokenClaims is nil.
func (*IdTokenClaims) String ¶
func (i *IdTokenClaims) String() string
type Insights ¶
type Insights struct {
EnablePprof bool `mapstructure:"enable_pprof"`
EnableBlockProfile bool `mapstructure:"enable_block_profile"`
MonitorConnections bool `mapstructure:"monitor_connections"`
}
Insights is a configuration structure for enabling profiling, block profiling, and connection monitoring capabilities.
func (*Insights) IsBlockProfileEnabled ¶ added in v1.4.11
IsBlockProfileEnabled checks if block profiling is enabled in the Insights configuration. Returns false if the Insights is nil.
func (*Insights) IsMonitorConnectionsEnabled ¶ added in v1.7.4
IsMonitorConnectionsEnabled returns true if connection monitoring is enabled. Returns false if the Insights is nil.
func (*Insights) IsPprofEnabled ¶ added in v1.4.11
IsPprofEnabled checks if pprof profiling is enabled in the Insights configuration. Returns false if the Insights is nil.
type JWTAuth ¶ added in v1.7.0
type JWTAuth struct {
Enabled bool `mapstructure:"enabled"`
SecretKey string `mapstructure:"secret_key" validate:"omitempty,min=32,alphanumsymbol,excludesall= "`
TokenExpiry time.Duration `mapstructure:"token_expiry" validate:"omitempty,gt=0"`
RefreshToken bool `mapstructure:"refresh_token"`
RefreshTokenExpiry time.Duration `mapstructure:"refresh_token_expiry" validate:"omitempty,gt=0"`
Users []*JWTUser `mapstructure:"users" validate:"omitempty,dive"`
StoreInRedis bool `mapstructure:"store_in_redis"`
}
JWTAuth represents the configuration for JWT authentication.
func (*JWTAuth) GetRefreshTokenExpiry ¶ added in v1.7.2
GetRefreshTokenExpiry returns the refresh token expiry duration. Returns 0 if the JWTAuth is nil.
func (*JWTAuth) GetSecretKey ¶ added in v1.7.0
GetSecretKey returns the secret key used for JWT signing. Returns an empty string if the JWTAuth is nil.
func (*JWTAuth) GetTokenExpiry ¶ added in v1.7.0
GetTokenExpiry returns the token expiry duration. Returns 0 if the JWTAuth is nil.
func (*JWTAuth) GetUsers ¶ added in v1.7.0
GetUsers returns the list of JWT users. Returns an empty slice if the JWTAuth is nil.
func (*JWTAuth) IsEnabled ¶ added in v1.7.0
IsEnabled returns true if JWT authentication is enabled, otherwise false. Returns false if the JWTAuth is nil.
func (*JWTAuth) IsRefreshTokenEnabled ¶ added in v1.7.0
IsRefreshTokenEnabled returns true if refresh tokens are enabled. Returns false if the JWTAuth is nil.
func (*JWTAuth) IsStoreInRedisEnabled ¶ added in v1.7.0
IsStoreInRedisEnabled returns true if tokens should be stored in Redis. Returns false if the JWTAuth is nil.
type JWTUser ¶ added in v1.7.0
type JWTUser struct {
Username string `mapstructure:"username" validate:"required,excludesall= "`
Password string `mapstructure:"password" validate:"required,min=8,excludesall= "`
Roles []string `mapstructure:"roles" validate:"omitempty,dive"`
}
JWTUser represents a user configuration for JWT authentication.
func (*JWTUser) GetPassword ¶ added in v1.7.0
GetPassword returns the password of the JWT user. Returns an empty string if the JWTUser is nil.
func (*JWTUser) GetRoles ¶ added in v1.7.0
GetRoles returns the roles of the JWT user. Returns an empty slice if the JWTUser is nil.
func (*JWTUser) GetUsername ¶ added in v1.7.0
GetUsername returns the username of the JWT user. Returns an empty string if the JWTUser is nil.
type KeepAlive ¶ added in v1.7.3
type KeepAlive struct {
Enabled bool `mapstructure:"enabled"`
Timeout time.Duration `mapstructure:"timeout" validate:"omitempty,gt=0"`
MaxIdleConns int `mapstructure:"max_idle_connections" validate:"omitempty,gte=1"`
MaxIdleConnsPerHost int `mapstructure:"max_idle_connections_per_host" validate:"omitempty,gte=0"`
}
KeepAlive represents the configuration for HTTP connection keep-alive optimization.
func (*KeepAlive) GetMaxIdleConns ¶ added in v1.7.3
GetMaxIdleConns returns the maximum number of idle connections. Returns 0 if the KeepAlive is nil.
func (*KeepAlive) GetMaxIdleConnsPerHost ¶ added in v1.7.3
GetMaxIdleConnsPerHost returns the maximum number of idle connections per host. Returns 0 if the KeepAlive is nil.
func (*KeepAlive) GetTimeout ¶ added in v1.7.3
GetTimeout returns the keep-alive timeout duration. Returns 0 if the KeepAlive is nil.
type LDAPAttributeMapping ¶
type LDAPAttributeMapping struct {
AccountField string `mapstructure:"account_field" validate:"required"` // Webauthn is not implemented, yet.
TOTPSecretField string `mapstructure:"totp_secret_field" validate:"omitempty"`
TOTPRecoveryField string `mapstructure:"totp_recovery_field" validate:"omitempty"`
DisplayNameField string `mapstructure:"display_name_field" validate:"omitempty"`
CredentialObject string `mapstructure:"credential_object" validate:"omitempty"`
CredentialIDField string `mapstructure:"credential_id_field" validate:"omitempty"`
PublicKeyField string `mapstructure:"public_key_field" validate:"omitempty"`
UniqueUserIDField string `mapstructure:"unique_user_id_field" validate:"omitempty"`
AAGUIDField string `mapstructure:"aaguid_field" validate:"omitempty"`
SignCountField string `mapstructure:"sign_count_field" validate:"omitempty"`
}
func (*LDAPAttributeMapping) GetAAGUIDField ¶ added in v1.7.7
func (m *LDAPAttributeMapping) GetAAGUIDField() string
GetAAGUIDField retrieves the AAGUID field name from the LDAPAttributeMapping. Returns an empty string if the LDAPAttributeMapping is nil.
func (*LDAPAttributeMapping) GetCredentialIDField ¶ added in v1.7.7
func (m *LDAPAttributeMapping) GetCredentialIDField() string
GetCredentialIDField retrieves the credential ID field name from the LDAPAttributeMapping. Returns an empty string if the LDAPAttributeMapping is nil.
func (*LDAPAttributeMapping) GetCredentialObject ¶ added in v1.7.7
func (m *LDAPAttributeMapping) GetCredentialObject() string
GetCredentialObject retrieves the credential object field name from the LDAPAttributeMapping. Returns an empty string if the LDAPAttributeMapping is nil.
func (*LDAPAttributeMapping) GetDisplayNameField ¶ added in v1.7.7
func (m *LDAPAttributeMapping) GetDisplayNameField() string
GetDisplayNameField retrieves the display name field from the LDAPAttributeMapping. Returns an empty string if the LDAPAttributeMapping is nil.
func (*LDAPAttributeMapping) GetPublicKeyField ¶ added in v1.7.7
func (m *LDAPAttributeMapping) GetPublicKeyField() string
GetPublicKeyField retrieves the public key field name from the LDAPAttributeMapping. Returns an empty string if the LDAPAttributeMapping is nil.
func (*LDAPAttributeMapping) GetSignCountField ¶ added in v1.7.7
func (m *LDAPAttributeMapping) GetSignCountField() string
GetSignCountField retrieves the sign count field name from the LDAPAttributeMapping. Returns an empty string if the LDAPAttributeMapping is nil.
func (*LDAPAttributeMapping) GetTOTPRecoveryField ¶ added in v1.7.7
func (m *LDAPAttributeMapping) GetTOTPRecoveryField() string
GetTOTPRecoveryField retrieves the TOTP recovery field name from the LDAPAttributeMapping. Returns an empty string if the LDAPAttributeMapping is nil.
func (*LDAPAttributeMapping) GetTOTPSecretField ¶ added in v1.7.7
func (m *LDAPAttributeMapping) GetTOTPSecretField() string
GetTOTPSecretField retrieves the TOTP secret field name from the LDAPAttributeMapping. Returns an empty string if the LDAPAttributeMapping is nil.
func (*LDAPAttributeMapping) GetUniqueUserIDField ¶ added in v1.7.7
func (m *LDAPAttributeMapping) GetUniqueUserIDField() string
GetUniqueUserIDField retrieves the unique user ID field name from the LDAPAttributeMapping. Returns an empty string if the LDAPAttributeMapping is nil.
type LDAPConf ¶
type LDAPConf struct {
PoolOnly bool `mapstructure:"pool_only"`
StartTLS bool
TLSSkipVerify bool `mapstructure:"tls_skip_verify"`
SASLExternal bool `mapstructure:"sasl_external"`
NumberOfWorkers int `mapstructure:"number_of_workers" validate:"omitempty,min=1,max=1000000"`
LookupPoolSize int `mapstructure:"lookup_pool_size" validate:"required,min=1"`
LookupIdlePoolSize int `mapstructure:"lookup_idle_pool_size" validate:"omitempty,min=0"`
AuthPoolSize int `mapstructure:"auth_pool_size" validate:"validateAuthPoolRequired"`
AuthIdlePoolSize int `mapstructure:"auth_idle_pool_size" validate:"omitempty,min=0"`
BindDN string `mapstructure:"bind_dn" validate:"omitempty,printascii"`
BindPW string `mapstructure:"bind_pw" validate:"omitempty"`
TLSCAFile string `mapstructure:"tls_ca_cert" validate:"omitempty,file"`
TLSClientCert string `mapstructure:"tls_client_cert" validate:"omitempty,file"`
TLSClientKey string `mapstructure:"tls_client_key" validate:"omitempty,file"`
ConnectAbortTimeout time.Duration `mapstructure:"connect_abort_timeout" validate:"omitempty,max=10m"`
ServerURIs []string `mapstructure:"server_uri" validate:"required,dive,uri"`
}
func (*LDAPConf) GetAuthIdlePoolSize ¶ added in v1.7.7
GetAuthIdlePoolSize retrieves the authentication idle pool size from the LDAPConf. Returns definitions.LDAPIdlePoolSize if the LDAPConf is nil.
func (*LDAPConf) GetAuthPoolSize ¶ added in v1.7.7
GetAuthPoolSize retrieves the authentication pool size from the LDAPConf. Returns definitions.LDAPIdlePoolSize if the LDAPConf is nil.
func (*LDAPConf) GetBindDN ¶ added in v1.7.7
GetBindDN retrieves the bind DN from the LDAPConf. Returns an empty string if the LDAPConf is nil.
func (*LDAPConf) GetBindPW ¶ added in v1.7.7
GetBindPW retrieves the bind password from the LDAPConf. Returns an empty string if the LDAPConf is nil.
func (*LDAPConf) GetConnectAbortTimeout ¶ added in v1.7.7
GetConnectAbortTimeout retrieves the connect abort timeout duration from the LDAPConf. Returns 0 if the LDAPConf is nil.
func (*LDAPConf) GetLookupIdlePoolSize ¶ added in v1.7.7
GetLookupIdlePoolSize retrieves the lookup idle pool size from the LDAPConf. Returns definitions.LDAPIdlePoolSize if the LDAPConf is nil.
func (*LDAPConf) GetLookupPoolSize ¶ added in v1.7.7
GetLookupPoolSize retrieves the lookup pool size from the LDAPConf. Returns definitions.LDAPIdlePoolSize if the LDAPConf is nil.
func (*LDAPConf) GetNumberOfWorkers ¶ added in v1.6.5
GetNumberOfWorkers returns the number of workers configured in the LDAPConf. Returns 0 if the LDAPConf is nil.
func (*LDAPConf) GetServerURIs ¶ added in v1.7.7
GetServerURIs retrieves the server URIs from the LDAPConf. Returns []string{"ldap://localhost"} slice if the LDAPConf is nil.
func (*LDAPConf) GetTLSCAFile ¶ added in v1.7.7
GetTLSCAFile retrieves the TLS CA certificate file path from the LDAPConf. Returns an empty string if the LDAPConf is nil.
func (*LDAPConf) GetTLSClientCert ¶ added in v1.7.7
GetTLSClientCert retrieves the TLS client certificate file path from the LDAPConf. Returns an empty string if the LDAPConf is nil.
func (*LDAPConf) GetTLSClientKey ¶ added in v1.7.7
GetTLSClientKey retrieves the TLS client key file path from the LDAPConf. Returns an empty string if the LDAPConf is nil.
func (*LDAPConf) IsPoolOnly ¶ added in v1.7.7
IsPoolOnly checks if the LDAPConf is configured for pool-only mode. Returns false if the LDAPConf is nil.
func (*LDAPConf) IsSASLExternal ¶ added in v1.7.7
IsSASLExternal checks if SASL External authentication is enabled in the LDAPConf. Returns false if the LDAPConf is nil.
func (*LDAPConf) IsStartTLS ¶ added in v1.7.7
IsStartTLS checks if StartTLS is enabled in the LDAPConf. Returns false if the LDAPConf is nil.
func (*LDAPConf) IsTLSSkipVerify ¶ added in v1.7.7
IsTLSSkipVerify checks if TLS verification should be skipped in the LDAPConf. Returns false if the LDAPConf is nil.
type LDAPFilter ¶
type LDAPFilter struct {
User string `mapstructure:"user" validate:"omitempty"`
ListAccounts string `mapstructure:"list_accounts" validate:"omitempty"`
WebAuthnCredentials string `mapstructure:"webauthn_credentials" validate:"omitempty"`
}
func (*LDAPFilter) GetWebAuthnCredentialsFilter ¶ added in v1.7.7
func (f *LDAPFilter) GetWebAuthnCredentialsFilter() string
GetWebAuthnCredentialsFilter returns an LDAP filter which is used to find WebAuthn credentials. Returns an empty string if the LDAPFilter is nil.
type LDAPScope ¶
type LDAPScope struct {
// contains filtered or unexported fields
}
LDAPScope is the search scope for an LDAP server.
type LDAPSearchProtocol ¶
type LDAPSearchProtocol struct {
Protocols []string `mapstructure:"protocol" validate:"required"`
CacheName string `mapstructure:"cache_name" validate:"required,printascii,excludesall= "`
PoolName string `mapstructure:"pool_name" validate:"omitempty,printascii,excludesall= "`
BaseDN string `mapstructure:"base_dn" validate:"required,printascii"`
Scope string `mapstructure:"scope" validate:"omitempty,oneof=base one sub"`
LDAPFilter `mapstructure:"filter" validate:"required"`
LDAPAttributeMapping `mapstructure:"mapping" validate:"required"`
// LDAP result attributes
Attributes []string `mapstructure:"attribute" validate:"required,dive,printascii,excludesall= "`
}
func (*LDAPSearchProtocol) GetAccountField ¶
func (p *LDAPSearchProtocol) GetAccountField() (string, error)
GetAccountField returns the LDAP attribute for an account. It returns a DetailedError, if no value has been configured.
func (*LDAPSearchProtocol) GetAttributes ¶
func (p *LDAPSearchProtocol) GetAttributes() ([]string, error)
GetAttributes returns a list of attributes that are requested from the LDAP server. It returns a DetailedError, if no value has been configured.
func (*LDAPSearchProtocol) GetBaseDN ¶
func (p *LDAPSearchProtocol) GetBaseDN() (string, error)
GetBaseDN returns the base DN that is used for each specific protocol. It returns a DetailedError, if no value has been configured.
func (*LDAPSearchProtocol) GetCacheName ¶
func (p *LDAPSearchProtocol) GetCacheName() (string, error)
GetCacheName returns the Redis cache domain. It returns a DetailedError, if no value has been configured.
func (*LDAPSearchProtocol) GetListAccountsFilter ¶
func (p *LDAPSearchProtocol) GetListAccountsFilter() (string, error)
GetListAccountsFilter returns an LDAP filter which is used to find all user accounts. It returns a DetailedError, if no value has been configured.
func (*LDAPSearchProtocol) GetPoolName ¶ added in v1.5.0
func (p *LDAPSearchProtocol) GetPoolName() string
GetPoolName returns the configured pool name. If no pool name is configured, it defaults to DefaultBackendName.
func (*LDAPSearchProtocol) GetProtocols ¶ added in v1.7.7
func (p *LDAPSearchProtocol) GetProtocols() []string
GetProtocols retrieves the list of protocols from the LDAPSearchProtocol. Returns an empty slice if the LDAPSearchProtocol is nil or if the Protocols field is nil.
func (*LDAPSearchProtocol) GetScope ¶
func (p *LDAPSearchProtocol) GetScope() (*LDAPScope, error)
GetScope returns an LDAP search scope. If no scope was defined, it automatically sets the subtree scope. If a scope has been defined and is unknown, it returns a DetailedError.
func (*LDAPSearchProtocol) GetUserFilter ¶
func (p *LDAPSearchProtocol) GetUserFilter() (string, error)
GetUserFilter returns an LDAP search filter to find a user. It returns a DetailedError, if no value has been configured.
type LDAPSection ¶
type LDAPSection struct {
Config *LDAPConf `mapstructure:"config" validate:"required"`
OptionalLDAPPools map[string]*LDAPConf `mapstructure:"optional_ldap_pools" validate:"omitempty,dive,validatDefaultBackendName"`
Search []LDAPSearchProtocol `mapstructure:"search" validate:"omitempty,dive"`
}
func (*LDAPSection) GetConfig ¶
func (l *LDAPSection) GetConfig() any
GetConfig retrieves the LDAP configuration from the receiver. Returns nil if the receiver is nil.
func (*LDAPSection) GetOptionalLDAPPools ¶ added in v1.5.0
func (l *LDAPSection) GetOptionalLDAPPools() map[string]*LDAPConf
GetOptionalLDAPPools returns a map of LDAP pool configurations if available, or an empty map if the receiver is nil.
func (*LDAPSection) GetProtocols ¶
func (l *LDAPSection) GetProtocols() any
GetProtocols returns the search protocols of the LDAP configuration, or an empty slice if the receiver is nil.
func (*LDAPSection) GetSearch ¶ added in v1.7.7
func (l *LDAPSection) GetSearch() []LDAPSearchProtocol
GetSearch returns the LDAP search protocols if available, or an empty slice if the receiver is nil.
func (*LDAPSection) String ¶
func (l *LDAPSection) String() string
type Log ¶
type Log struct {
JSON bool `mapstructure:"json"`
Color bool `mapstructure:"color"`
Level Verbosity `mapstructure:"level"`
DbgModules []*DbgModule `mapstructure:"debug_modules" validate:"omitempty,dive"`
}
Log represents the configuration for logging.
func (*Log) GetDebugModules ¶ added in v1.4.11
GetDebugModules retrieves the list of debug modules configured in the Log instance. Returns an empty slice if the Log is nil.
func (*Log) GetLogLevel ¶ added in v1.4.11
GetLogLevel returns the name of the current logging level configured in the Log instance. Returns 0 if the Log is nil or the Level is nil.
func (*Log) GetLogLevelName ¶ added in v1.4.11
GetLogLevelName returns the name of the current logging level as a string. Returns an empty string if the Log is nil or the Level is nil.
func (*Log) IsLogFormatJSON ¶ added in v1.4.11
IsLogFormatJSON indicates whether the log format is set to JSON based on the `JSON` field in the `Log` struct. Returns false if the Log is nil.
func (*Log) IsLogUsesColor ¶ added in v1.4.11
IsLogUsesColor determines if colored output is enabled for logging. Returns false if the Log is nil.
type LuaAction ¶
type LuaAction struct {
ActionType string `mapstructure:"type" validate:"required,oneof=brute_force rbl tls_encryption relay_domains lua post"`
ScriptName string `mapstructure:"name" validate:"required"`
ScriptPath string `mapstructure:"script_path" validate:"required,file"`
}
func (*LuaAction) GetAction ¶
GetAction returns the ActionType, ScriptName, and ScriptPath of a LuaAction. It is a method of the LuaAction struct. The ActionType field represents the type of the Lua action. The ScriptName field represents the name of the Lua script. The ScriptPath field represents the path to the Lua script file. It returns these values as strings.
func (*LuaAction) GetActionType ¶ added in v1.7.7
GetActionType retrieves the ActionType from the LuaAction. Returns an empty string if the LuaAction is nil.
func (*LuaAction) GetScriptName ¶ added in v1.7.7
GetScriptName retrieves the ScriptName from the LuaAction. Returns an empty string if the LuaAction is nil.
func (*LuaAction) GetScriptPath ¶ added in v1.7.7
GetScriptPath retrieves the ScriptPath from the LuaAction. Returns an empty string if the LuaAction is nil.
type LuaConf ¶
type LuaConf struct {
NumberOfWorkers int `mapstructure:"number_of_workers" validate:"omitempty,min=1,max=1000000"`
PackagePath string `mapstructure:"package_path"`
BackendScriptPath string `mapstructure:"backend_script_path" validate:"omitempty,file"`
InitScriptPath string `mapstructure:"init_script_path" validate:"omitempty,file"`
InitScriptPaths []string `mapstructure:"init_script_paths" validate:"omitempty,dive,file"`
}
func (*LuaConf) GetBackendScriptPath ¶ added in v1.7.7
GetBackendScriptPath retrieves the BackendScriptPath from the LuaConf. Returns an empty string if the LuaConf is nil.
func (*LuaConf) GetInitScriptPath ¶ added in v1.7.7
GetInitScriptPath retrieves the InitScriptPath from the LuaConf. Returns an empty string if the LuaConf is nil.
func (*LuaConf) GetInitScriptPaths ¶ added in v1.7.7
GetInitScriptPaths retrieves the InitScriptPaths from the LuaConf. Returns an empty slice if the LuaConf is nil.
func (*LuaConf) GetNumberOfWorkers ¶ added in v1.6.5
GetNumberOfWorkers returns the number of workers configured in the LuaConf object. Defaults to 0 if the receiver is nil.
func (*LuaConf) GetPackagePath ¶ added in v1.7.7
GetPackagePath retrieves the PackagePath from the LuaConf. Returns an empty string if the LuaConf is nil.
type LuaFeature ¶
type LuaFeature struct {
Name string `mapstructure:"name" validate:"required"`
ScriptPath string `mapstructure:"script_path" validate:"required,file"`
}
func (*LuaFeature) GetName ¶ added in v1.7.7
func (l *LuaFeature) GetName() string
GetName retrieves the Name from the LuaFeature. Returns an empty string if the LuaFeature is nil.
func (*LuaFeature) GetScriptPath ¶ added in v1.7.7
func (l *LuaFeature) GetScriptPath() string
GetScriptPath retrieves the ScriptPath from the LuaFeature. Returns an empty string if the LuaFeature is nil.
func (*LuaFeature) String ¶
func (l *LuaFeature) String() string
type LuaFilter ¶
type LuaFilter struct {
Name string `mapstructure:"name" validate:"required"`
ScriptPath string `mapstructure:"script_path" validate:"required,file"`
}
func (*LuaFilter) GetName ¶ added in v1.7.7
GetName retrieves the Name from the LuaFilter. Returns an empty string if the LuaFilter is nil.
func (*LuaFilter) GetScriptPath ¶ added in v1.7.7
GetScriptPath retrieves the ScriptPath from the LuaFilter. Returns an empty string if the LuaFilter is nil.
type LuaHooks ¶ added in v1.3.9
type LuaHooks struct {
Location string `mapstructure:"http_location" validate:"required,printascii,excludesall= "`
Method string `mapstructure:"http_method" validate:"required,oneof=HEAD GET POST PUT DELETE PATCH"`
ContentType string `mapstructure:"content_type" validate:"omitempty,printascii,excludesall= "`
ScriptPath string `mapstructure:"script_path" validate:"required,file"`
Roles []string `mapstructure:"roles"`
}
func (*LuaHooks) GetContentType ¶ added in v1.7.11
GetContentType retrieves the Content-Type from the LuaHooks. Returns "application/json" if the LuaHooks is nil or the ContentType is an empty string
func (*LuaHooks) GetLocation ¶ added in v1.7.7
GetLocation retrieves the Location from the LuaHooks. Returns an empty string if the LuaHooks is nil.
func (*LuaHooks) GetMethod ¶ added in v1.7.7
GetMethod retrieves the Method from the LuaHooks. Returns an empty string if the LuaHooks is nil.
func (*LuaHooks) GetRoles ¶ added in v1.7.0
GetRoles returns the roles configured for the hook. If no roles are configured, it returns an empty slice.
func (*LuaHooks) GetScriptPath ¶ added in v1.7.7
GetScriptPath retrieves the ScriptPath from the LuaHooks. Returns an empty string if the LuaHooks is nil.
type LuaSearchProtocol ¶
type LuaSearchProtocol struct {
Protocols []string `mapstructure:"protocol"`
CacheName string `mapstructure:"cache_name" validate:"required,printascii,excludesall= "`
BackendName string `mapstructure:"backend_name" validate:"omitempty,printascii,excludesall= "`
}
func (*LuaSearchProtocol) GetBackendName ¶ added in v1.5.0
func (l *LuaSearchProtocol) GetBackendName() string
GetBackendName returns the backend name configured in LuaSearchProtocol or a default value if not specified.
func (*LuaSearchProtocol) GetCacheName ¶
func (l *LuaSearchProtocol) GetCacheName() (string, error)
GetCacheName returns the Redis cache domain. It returns a DetailedError, if no value has been configured.
func (*LuaSearchProtocol) GetProtocols ¶ added in v1.7.7
func (l *LuaSearchProtocol) GetProtocols() []string
GetProtocols retrieves the list of protocols from the LuaSearchProtocol. Returns an empty slice if the LuaSearchProtocol is nil or if the Protocols field is nil.
type LuaSection ¶
type LuaSection struct {
Actions []LuaAction `mapstructure:"actions" validate:"omitempty,dive"`
Features []LuaFeature `mapstructure:"features" validate:"omitempty,dive"`
Filters []LuaFilter `mapstructure:"filters" validate:"omitempty,dive"`
Hooks []LuaHooks `mapstructure:"custom_hooks" validate:"omitempty,dive"`
Config *LuaConf `mapstructure:"config" validate:"omitempty"`
OptionalLuaBackends map[string]*LuaConf `mapstructure:"optional_lua_backends" validate:"omitempty,dive,validateOptionalLuaBackend"`
Search []LuaSearchProtocol `mapstructure:"search" validate:"omitempty,dive"`
}
func (*LuaSection) GetActions ¶ added in v1.7.7
func (l *LuaSection) GetActions() []LuaAction
GetActions retrieves the list of LuaAction from the LuaSection. Returns an empty slice if the LuaSection is nil.
func (*LuaSection) GetConfig ¶
func (l *LuaSection) GetConfig() any
GetConfig retrieves the `Config` field from the LuaSection. Returns an empty LuaConf if the LuaSection is nil.
func (*LuaSection) GetFeatures ¶ added in v1.7.7
func (l *LuaSection) GetFeatures() []LuaFeature
GetFeatures retrieves the list of LuaFeature from the LuaSection. Returns an empty slice if the LuaSection is nil.
func (*LuaSection) GetFilters ¶ added in v1.7.7
func (l *LuaSection) GetFilters() []LuaFilter
GetFilters retrieves the list of LuaFilter from the LuaSection. Returns an empty slice if the LuaSection is nil.
func (*LuaSection) GetHooks ¶ added in v1.7.7
func (l *LuaSection) GetHooks() []LuaHooks
GetHooks retrieves the list of LuaHooks from the LuaSection. Returns an empty slice if the LuaSection is nil.
func (*LuaSection) GetOptionalLuaBackends ¶ added in v1.5.0
func (l *LuaSection) GetOptionalLuaBackends() map[string]*LuaConf
GetOptionalLuaBackends retrieves the `OptionalLuaBackends` field from the LuaSection. Returns an empty map if the LuaSection is nil.
func (*LuaSection) GetProtocols ¶
func (l *LuaSection) GetProtocols() any
GetProtocols retrieves the search protocols from the LuaSection. Returns an empty slice if the LuaSection is nil.
func (*LuaSection) String ¶
func (l *LuaSection) String() string
type Master ¶
type Master struct {
Address string `mapstructure:"address" validate:"omitempty,hostname_port"`
Username string `mapstructure:"username" validate:"omitempty,excludesall= "`
Password string `mapstructure:"password" validate:"omitempty,excludesall= "`
}
Master represents the configuration for the master Redis instance. Includes fields for address, username, and password for the master instance.
func (Master) GetAddress ¶ added in v1.4.11
GetAddress returns the address of the master Redis instance stored in the Master struct.
func (Master) GetPassword ¶ added in v1.4.11
GetPassword returns the password of the master Redis instance stored in the Master struct.
func (Master) GetUsername ¶ added in v1.4.11
GetUsername returns the username of the master Redis instance stored in the Master struct.
type MasterUser ¶
type MasterUser struct {
Enabled bool `mapstructure:"enabled"`
Delimiter string `mapstructure:"delimiter" validate:"omitempty,len=1,printascii"`
}
MasterUser represents a user configuration with flags for enabling and setting delimiters.
func (*MasterUser) GetDelimiter ¶ added in v1.4.11
func (m *MasterUser) GetDelimiter() string
GetDelimiter retrieves the delimiter value associated with the MasterUser configuration. Returns an empty string if the MasterUser is nil.
func (*MasterUser) IsEnabled ¶ added in v1.4.11
func (m *MasterUser) IsEnabled() bool
IsEnabled determines if the MasterUser is enabled by checking the Enabled field. Returns false if the MasterUser is nil.
type OIDCCustomClaim ¶
func (*OIDCCustomClaim) GetName ¶ added in v1.7.7
func (c *OIDCCustomClaim) GetName() string
GetName retrieves the name of the custom claim. Returns an empty string if the OIDCCustomClaim is nil.
func (*OIDCCustomClaim) GetType ¶ added in v1.7.7
func (c *OIDCCustomClaim) GetType() string
GetType retrieves the type of the custom claim. Returns an empty string if the OIDCCustomClaim is nil.
type Oauth2Client ¶
type Oauth2Client struct {
SkipConsent bool `mapstructure:"skip_consent"`
SkipTOTP bool `mapstructure:"skip_totp"`
ClientName string `mapstructure:"name" validate:"required"`
ClientId string `mapstructure:"client_id" validate:"required"`
Subject string `mapstructure:"subject" validate:"required,alphanumunicode,excludesall= "`
Claims IdTokenClaims `mapstructure:"claims" validate:"required"`
}
func (*Oauth2Client) GetClaims ¶ added in v1.7.7
func (c *Oauth2Client) GetClaims() IdTokenClaims
GetClaims retrieves the ID token claims from the Oauth2Client. Returns an empty IdTokenClaims struct if the Oauth2Client is nil.
func (*Oauth2Client) GetClientId ¶ added in v1.7.7
func (c *Oauth2Client) GetClientId() string
GetClientId retrieves the client ID from the Oauth2Client. Returns an empty string if the Oauth2Client is nil.
func (*Oauth2Client) GetClientName ¶ added in v1.7.7
func (c *Oauth2Client) GetClientName() string
GetClientName retrieves the client name from the Oauth2Client. Returns an empty string if the Oauth2Client is nil.
func (*Oauth2Client) GetSubject ¶ added in v1.7.7
func (c *Oauth2Client) GetSubject() string
GetSubject retrieves the subject from the Oauth2Client. Returns an empty string if the Oauth2Client is nil.
func (*Oauth2Client) IsSkipConsent ¶ added in v1.7.7
func (c *Oauth2Client) IsSkipConsent() bool
IsSkipConsent checks if consent should be skipped for this client. Returns false if the Oauth2Client is nil.
func (*Oauth2Client) IsSkipTOTP ¶ added in v1.7.7
func (c *Oauth2Client) IsSkipTOTP() bool
IsSkipTOTP checks if TOTP verification should be skipped for this client. Returns false if the Oauth2Client is nil.
type Oauth2CustomScope ¶
type Oauth2CustomScope struct {
Name string `mapstructure:"name" validate:"required,alphanumunicode,excludesall= "`
Description string `mapstructure:"description" validate:"required"`
Claims []OIDCCustomClaim `mapstructure:"claims" validate:"required,dive"`
Other map[string]any `mapstructure:",remain"`
}
func (*Oauth2CustomScope) GetClaims ¶ added in v1.7.7
func (s *Oauth2CustomScope) GetClaims() []OIDCCustomClaim
GetClaims retrieves the list of custom claims for this scope. Returns an empty slice if the Oauth2CustomScope is nil.
func (*Oauth2CustomScope) GetDescription ¶ added in v1.7.7
func (s *Oauth2CustomScope) GetDescription() string
GetDescription retrieves the description of the custom scope. Returns an empty string if the Oauth2CustomScope is nil.
func (*Oauth2CustomScope) GetName ¶ added in v1.7.7
func (s *Oauth2CustomScope) GetName() string
GetName retrieves the name of the custom scope. Returns an empty string if the Oauth2CustomScope is nil.
func (*Oauth2CustomScope) GetOther ¶ added in v1.7.7
func (s *Oauth2CustomScope) GetOther() map[string]any
GetOther retrieves the map of additional properties for this scope. Returns nil if the Oauth2CustomScope is nil.
type Oauth2Section ¶
type Oauth2Section struct {
CustomScopes []Oauth2CustomScope `mapstructure:"custom_scopes" validate:"omitempty,dive"`
Clients []Oauth2Client `mapstructure:"clients" validate:"omitempty,dive"`
}
func (*Oauth2Section) GetClients ¶ added in v1.7.7
func (o *Oauth2Section) GetClients() []Oauth2Client
GetClients retrieves the list of clients from the Oauth2Section. Returns an empty slice if the Oauth2Section is nil.
func (*Oauth2Section) GetCustomScopes ¶ added in v1.7.7
func (o *Oauth2Section) GetCustomScopes() []Oauth2CustomScope
GetCustomScopes retrieves the list of custom scopes from the Oauth2Section. Returns an empty slice if the Oauth2Section is nil.
func (*Oauth2Section) String ¶
func (o *Oauth2Section) String() string
type PrometheusTimer ¶ added in v1.1.0
type PrometheusTimer struct {
Enabled bool `mapstructure:"enabled"`
Labels []string `` /* 138-byte string literal not displayed */
}
PrometheusTimer is a configuration structure for enabling and setting labels for Prometheus metrics timers.
func (*PrometheusTimer) GetLabels ¶ added in v1.4.11
func (p *PrometheusTimer) GetLabels() []string
GetLabels returns the list of labels configured for the PrometheusTimer. Returns an empty slice if the PrometheusTimer is nil.
func (*PrometheusTimer) IsEnabled ¶ added in v1.4.11
func (p *PrometheusTimer) IsEnabled() bool
IsEnabled indicates whether the Prometheus timer is enabled based on the Enabled property of PrometheusTimer. Returns false if the PrometheusTimer is nil.
type Protocol ¶
type Protocol struct {
// contains filtered or unexported fields
}
Protocol is the protocol used between a remote client and a server. This server sets the protocol in an HTTP request header "Auth-Protocol" (Nginx protocol).
func NewProtocol ¶
NewProtocol creates a new Protocol object with the given protocol string. It initializes the name field of the Protocol object.
Example usage: protocol := NewProtocol("http")
type RBL ¶
type RBL struct {
Name string `mapstructure:"name" validate:"required"`
RBL string `mapstructure:"rbl" validate:"required,hostname"`
IPv4 bool
IPv6 bool
AllowFailure bool `mapstructure:"allow_failure"`
ReturnCode string `mapstructure:"return_code" validate:"omitempty,ip4_addr"`
ReturnCodes []string `mapstructure:"return_codes" validate:"required,dive,ip4_addr"`
Weight int `mapstructure:"weight" validate:"omitempty,min=-100,max=100"`
}
func (*RBL) GetName ¶ added in v1.7.7
GetName retrieves the name of the RBL. Returns an empty string if the RBL is nil.
func (*RBL) GetRBL ¶ added in v1.7.7
GetRBL retrieves the RBL hostname. Returns an empty string if the RBL is nil.
func (*RBL) GetReturnCode ¶ added in v1.7.7
GetReturnCode retrieves the return code for the RBL. Returns an empty string if the RBL is nil. Deprecated: Use GetReturnCodes() instead
func (*RBL) GetReturnCodes ¶ added in v1.7.11
GetReturnCodes retrieves the list of return codes for the RBL. Returns an empty slice if the RBL is nil.
func (*RBL) GetWeight ¶ added in v1.7.7
GetWeight retrieves the weight value for the RBL. Returns 0 if the RBL is nil.
func (*RBL) IsAllowFailure ¶ added in v1.7.7
IsAllowFailure checks if failures are allowed for this RBL. Returns false if the RBL is nil.
type RBLSection ¶
type RBLSection struct {
SoftWhitelist `mapstructure:"soft_whitelist"`
Lists []RBL `mapstructure:"lists" validate:"required,dive"`
Threshold int `mapstructure:"threshold" validate:"omitempty,min=0,max=100"`
IPWhiteList []string `mapstructure:"ip_whitelist" validate:"omitempty,dive,ip_addr|cidr"`
}
func (*RBLSection) GetIPWhiteList ¶ added in v1.7.7
func (r *RBLSection) GetIPWhiteList() []string
GetIPWhiteList retrieves the IP whitelist from the RBLSection. Returns an empty slice if the RBLSection is nil.
func (*RBLSection) GetLists ¶ added in v1.7.7
func (r *RBLSection) GetLists() []RBL
GetLists retrieves the list of RBL configurations from the RBLSection. Returns an empty slice if the RBLSection is nil.
func (*RBLSection) GetSoftWhitelist ¶ added in v1.7.7
func (r *RBLSection) GetSoftWhitelist() SoftWhitelist
GetSoftWhitelist retrieves the SoftWhitelist from the RBLSection. Returns nil if the RBLSection is nil.
func (*RBLSection) GetThreshold ¶ added in v1.7.7
func (r *RBLSection) GetThreshold() int
GetThreshold retrieves the threshold value from the RBLSection. Returns 0 as a default value if the RBLSection is nil.
func (*RBLSection) String ¶
func (r *RBLSection) String() string
type Redis ¶
type Redis struct {
DatabaseNmuber int `mapstructure:"database_number" validate:"omitempty,gte=0,lte=15"`
Prefix string `mapstructure:"prefix" validate:"omitempty,printascii,excludesall= "`
PasswordNonce string `mapstructure:"password_nonce" validate:"omitempty,min=16,alphanumsymbol,excludesall= "`
PoolSize int `mapstructure:"pool_size" validate:"omitempty,gte=1"`
IdlePoolSize int `mapstructure:"idle_pool_size" validate:"omitempty,gte=0"`
TLS TLS `mapstructure:"tls" validate:"omitempty"`
PosCacheTTL time.Duration `mapstructure:"positive_cache_ttl" validate:"omitempty,max=8760h"`
NegCacheTTL time.Duration `mapstructure:"negative_cache_ttl" validate:"omitempty,max=8760h"`
Master Master `mapstructure:"master" validate:"omitempty"`
Replica Replica `mapstructure:"replica" validate:"omitempty"`
Sentinels Sentinels `mapstructure:"sentinels" validate:"omitempty"`
Cluster Cluster `mapstructure:"cluster" validate:"omitempty"`
}
Redis represents the configuration settings for a Redis instance, including master, replica, sentinel, and cluster setups.
func (*Redis) GetCluster ¶ added in v1.4.11
GetCluster returns a pointer to the Cluster configuration of the Redis instance. Returns a new empty Cluster struct if the Redis is nil.
func (*Redis) GetDatabaseNumber ¶ added in v1.4.11
GetDatabaseNumber retrieves the configured database number for the Redis instance. Returns 0 if the Redis is nil.
func (*Redis) GetIdlePoolSize ¶ added in v1.4.11
GetIdlePoolSize retrieves the number of idle connections allowed in the connection pool. Returns 0 if the Redis is nil.
func (*Redis) GetNegCacheTTL ¶ added in v1.4.11
GetNegCacheTTL retrieves the negative cache time-to-live (TTL) duration configured for the Redis instance. Returns 0 if the Redis is nil.
func (*Redis) GetPasswordNonce ¶ added in v1.4.11
GetPasswordNonce retrieves the password nonce configured for the Redis instance. Returns an empty string if the Redis is nil.
func (*Redis) GetPoolSize ¶ added in v1.4.11
GetPoolSize retrieves the size of the connection pool configured for the Redis instance. Returns 0 if the Redis is nil.
func (*Redis) GetPosCacheTTL ¶ added in v1.4.11
GetPosCacheTTL retrieves the positive cache time-to-live (TTL) duration configured for the Redis instance. Returns 0 if the Redis is nil.
func (*Redis) GetPrefix ¶ added in v1.4.11
GetPrefix retrieves the prefix associated with the Redis instance configuration. Returns an empty string if the Redis is nil.
func (*Redis) GetSentinel ¶ added in v1.4.11
GetSentinel returns a pointer to the Sentinels configuration of the Redis instance. Returns a new empty Sentinels struct if the Redis is nil.
func (*Redis) GetStandaloneMaster ¶ added in v1.4.11
GetStandaloneMaster returns a pointer to the Master configuration of the Redis instance. Returns an empty Master struct if the Redis is nil.
func (*Redis) GetStandaloneReplica ¶ added in v1.4.11
GetStandaloneReplica returns a pointer to the Replica configuration of the Redis instance. Returns an empty Replica struct if the Redis is nil.
type RelayDomainsSection ¶
type RelayDomainsSection struct {
SoftWhitelist `mapstructure:"soft_whitelist"`
StaticDomains []string `mapstructure:"static" validate:"required,dive,hostname"`
}
func (*RelayDomainsSection) GetSoftWhitelist ¶ added in v1.7.7
func (r *RelayDomainsSection) GetSoftWhitelist() SoftWhitelist
GetSoftWhitelist retrieves the SoftWhitelist from the RelayDomainsSection. Returns an empty map if the RelayDomainsSection is nil.
func (*RelayDomainsSection) GetStaticDomains ¶ added in v1.7.7
func (r *RelayDomainsSection) GetStaticDomains() []string
GetStaticDomains retrieves the list of static domains from the RelayDomainsSection. Returns an empty slice if the RelayDomainsSection is nil.
func (*RelayDomainsSection) String ¶
func (r *RelayDomainsSection) String() string
type Replica ¶
type Replica struct {
Address string `mapstructure:"address" validate:"omitempty,hostname_port"`
Addresses []string `mapstructure:"addresses" validate:"omitempty,dive,hostname_port"`
}
Replica represents the configuration for a Redis replica instance.
func (Replica) GetAddress ¶ added in v1.4.11
GetAddress returns the address of the Redis replica instance as a string. Deprecated: Use GetAddresses() instead for retrieving all replica addresses
func (Replica) GetAddresses ¶ added in v1.4.11
GetAddresses retrieves the list of addresses associated with the Redis replica instance.
type Sentinels ¶
type Sentinels struct {
Master string `mapstructure:"master" validate:"required,printascii,excludesall= "`
Addresses []string `mapstructure:"addresses" validate:"required,dive,hostname_port"`
Username string `mapstructure:"username" validate:"omitempty,excludesall= "`
Password string `mapstructure:"password" validate:"omitempty,excludesall= "`
}
Sentinels represents the configuration for Redis Sentinel.
func (*Sentinels) GetAddresses ¶ added in v1.4.11
GetAddresses returns the list of addresses for the Redis Sentinel configuration. Returns an empty slice if the Sentinels is nil.
func (*Sentinels) GetMasterName ¶ added in v1.4.11
GetMasterName returns the name of the master Redis instance configured in the Sentinels struct. Returns an empty string if the Sentinels is nil.
func (*Sentinels) GetPassword ¶ added in v1.4.11
GetPassword retrieves the password configured for the Redis Sentinel connection. Returns an empty string if the Sentinels is nil.
func (*Sentinels) GetUsername ¶ added in v1.4.11
GetUsername retrieves the username configured for the Redis Sentinel connection. Returns an empty string if the Sentinels is nil.
type ServerSection ¶
type ServerSection struct {
Address string `mapstructure:"address" validate:"omitempty,tcp_addr"`
MaxConcurrentRequests int32 `mapstructure:"max_concurrent_requests" validate:"omitempty,gte=1"`
MaxPasswordHistoryEntries int32 `mapstructure:"max_password_history_entries" validate:"omitempty,gte=1"`
HTTP3 bool `mapstructure:"http3"`
HAproxyV2 bool `mapstructure:"haproxy_v2"`
DisabledEndpoints Endpoint `mapstructure:"disabled_endpoints" validate:"omitempty"`
TLS TLS `mapstructure:"tls" validate:"omitempty"`
BasicAuth BasicAuth `mapstructure:"basic_auth" validate:"omitempty"`
JWTAuth JWTAuth `mapstructure:"jwt_auth" validate:"omitempty"`
InstanceName string `mapstructure:"instance_name" validate:"omitempty,max=255,printascii"`
Log Log `mapstructure:"log" validate:"omitempty"`
Backends []*Backend `mapstructure:"backends" validate:"omitempty,dive"`
Features []*Feature `mapstructure:"features" validate:"omitempty,dive"`
BruteForceProtocols []*Protocol `mapstructure:"brute_force_protocols" validate:"omitempty,dive"`
HydraAdminUrl string `mapstructure:"ory_hydra_admin_url" validate:"omitempty,http_url"`
DNS DNS `mapstructure:"dns" validate:"omitempty"`
Insights Insights `mapstructure:"insights" validate:"omitempty"`
Redis Redis `mapstructure:"redis" vslidate:"required"`
MasterUser MasterUser `mapstructure:"master_user" validate:"omitempty"`
Frontend Frontend `mapstructure:"frontend" validate:"omitempty"`
PrometheusTimer PrometheusTimer `mapstructure:"prometheus_timer" validate:"omitempty"`
DefaultHTTPRequestHeader DefaultHTTPRequestHeader `mapstructure:"default_http_request_header" validate:"omitempty"`
HTTPClient HTTPClient `mapstructure:"http_client" validate:"omitempty"`
Compression Compression `mapstructure:"compression" validate:"omitempty"`
KeepAlive KeepAlive `mapstructure:"keep_alive" validate:"omitempty"`
}
ServerSection represents the configuration for a server, including network settings, TLS, logging, backends, features, protocol handling, and integrations with other systems such as Redis and Prometheus.
func (*ServerSection) GetBackends ¶ added in v1.4.11
func (s *ServerSection) GetBackends() []*Backend
GetBackends retrieves the list of backends configured in the ServerSection instance. Returns an empty slice if the ServerSection is nil.
func (*ServerSection) GetBasicAuth ¶ added in v1.4.11
func (s *ServerSection) GetBasicAuth() *BasicAuth
GetBasicAuth retrieves a pointer to the BasicAuth configuration from the ServerSection instance. Returns a new empty BasicAuth struct if the ServerSection is nil.
func (*ServerSection) GetBruteForceProtocols ¶ added in v1.4.11
func (s *ServerSection) GetBruteForceProtocols() []*Protocol
GetBruteForceProtocols retrieves the list of brute force protection protocols configured in the ServerSection. Returns an empty slice if the ServerSection is nil.
func (*ServerSection) GetCompression ¶ added in v1.7.3
func (s *ServerSection) GetCompression() *Compression
GetCompression retrieves a pointer to the Compression configuration from the ServerSection instance. Returns a new empty Compression struct if the ServerSection is nil.
func (*ServerSection) GetDNS ¶ added in v1.4.11
func (s *ServerSection) GetDNS() *DNS
GetDNS retrieves the DNS configuration from the ServerSection instance. Returns a new empty DNS struct if the ServerSection is nil.
func (*ServerSection) GetDefaultHTTPRequestHeader ¶ added in v1.4.11
func (s *ServerSection) GetDefaultHTTPRequestHeader() *DefaultHTTPRequestHeader
GetDefaultHTTPRequestHeader retrieves a pointer to the DefaultHTTPRequestHeader configuration from the ServerSection instance. Returns a new empty DefaultHTTPRequestHeader struct if the ServerSection is nil.
func (*ServerSection) GetEndpoint ¶ added in v1.4.11
func (s *ServerSection) GetEndpoint() *Endpoint
GetEndpoint retrieves a pointer to the DisabledEndpoints configuration from the ServerSection instance. Returns a new empty Endpoint struct if the ServerSection is nil.
func (*ServerSection) GetFeatures ¶ added in v1.4.11
func (s *ServerSection) GetFeatures() []*Feature
GetFeatures retrieves the list of features configured in the ServerSection instance. Returns an empty slice if the ServerSection is nil.
func (*ServerSection) GetHTTPClient ¶ added in v1.4.11
func (s *ServerSection) GetHTTPClient() *HTTPClient
GetHTTPClient retrieves the HTTP client configuration from the ServerSection instance. Returns a new empty HTTPClient struct if the ServerSection is nil.
func (*ServerSection) GetInsights ¶ added in v1.4.11
func (s *ServerSection) GetInsights() *Insights
GetInsights retrieves a pointer to the Insights configuration from the ServerSection instance. Returns a new empty Insights struct if the ServerSection is nil.
func (*ServerSection) GetInstanceName ¶ added in v1.4.11
func (s *ServerSection) GetInstanceName() string
GetInstanceName retrieves the instance name defined in the ServerSection configuration. Returns definitions.InstanceName as a default value if the ServerSection is nil.
func (*ServerSection) GetJWTAuth ¶ added in v1.7.0
func (s *ServerSection) GetJWTAuth() *JWTAuth
GetJWTAuth retrieves a pointer to the JWTAuth configuration from the ServerSection instance. Returns a new empty JWTAuth struct if the ServerSection is nil.
func (*ServerSection) GetKeepAlive ¶ added in v1.7.3
func (s *ServerSection) GetKeepAlive() *KeepAlive
GetKeepAlive retrieves a pointer to the KeepAlive configuration from the ServerSection instance. Returns a new empty KeepAlive struct if the ServerSection is nil.
func (*ServerSection) GetListenAddress ¶ added in v1.4.11
func (s *ServerSection) GetListenAddress() string
GetListenAddress retrieves the server's listen address from the ServerSection configuration. Returns an empty string if the ServerSection is nil.
func (*ServerSection) GetLog ¶ added in v1.4.11
func (s *ServerSection) GetLog() *Log
GetLog retrieves the logging configuration of the ServerSection instance. Returns a new empty Log struct if the ServerSection is nil.
func (*ServerSection) GetMasterUser ¶ added in v1.4.11
func (s *ServerSection) GetMasterUser() *MasterUser
GetMasterUser retrieves a pointer to the MasterUser configuration from the ServerSection instance. Returns a new empty MasterUser struct if the ServerSection is nil.
func (*ServerSection) GetMaxConcurrentRequests ¶ added in v1.4.11
func (s *ServerSection) GetMaxConcurrentRequests() int32
GetMaxConcurrentRequests retrieves the maximum number of concurrent requests allowed as configured in ServerSection. Returns 10 as a default value if the ServerSection is nil.
func (*ServerSection) GetMaxPasswordHistoryEntries ¶ added in v1.4.11
func (s *ServerSection) GetMaxPasswordHistoryEntries() int32
GetMaxPasswordHistoryEntries retrieves the maximum number of password history entries defined in the ServerSection configuration. Returns definitions.MaxPasswordHistoryEntries as a default value if the ServerSection is nil.
func (*ServerSection) GetPrometheusTimer ¶ added in v1.4.11
func (s *ServerSection) GetPrometheusTimer() *PrometheusTimer
GetPrometheusTimer retrieves a pointer to the PrometheusTimer configuration from the ServerSection instance. Returns a new empty PrometheusTimer struct if the ServerSection is nil.
func (*ServerSection) GetRedis ¶ added in v1.4.11
func (s *ServerSection) GetRedis() *Redis
GetRedis returns a pointer to the Redis configuration of the ServerSection instance. Returns a new empty Redis struct if the ServerSection is nil.
func (*ServerSection) GetTLS ¶ added in v1.4.11
func (s *ServerSection) GetTLS() *TLS
GetTLS retrieves the TLS configuration from the ServerSection instance. Returns a new empty TLS struct if the ServerSection is nil.
func (*ServerSection) IsHAproxyProtocolEnabled ¶ added in v1.4.11
func (s *ServerSection) IsHAproxyProtocolEnabled() bool
IsHAproxyProtocolEnabled checks if the HAProxy protocol (version 2) is enabled in the server configuration and returns the result. Returns false as a default value if the ServerSection is nil.
func (*ServerSection) IsHTTP3Enabled ¶ added in v1.4.11
func (s *ServerSection) IsHTTP3Enabled() bool
IsHTTP3Enabled checks if HTTP/3 protocol support is enabled in the server configuration and returns the corresponding boolean value. Returns false as a default value if the ServerSection is nil.
type SoftWhitelist ¶ added in v1.4.0
SoftWhitelist is a type that represents a map linking a string key to a slice of string values. Typically used to associate users with a list of CIDR networks.
func NewSoftWhitelist ¶ added in v1.4.0
func NewSoftWhitelist() SoftWhitelist
NewSoftWhitelist creates and returns a new instance of SoftWhitelist initialized as an empty map of string slices.
func (SoftWhitelist) Delete ¶ added in v1.4.0
func (s SoftWhitelist) Delete(username, network string)
Delete removes the specified network from the user's whitelist in the SoftWhitelist. If the network is the only entry, the user is removed from the whitelist. The function does nothing if the whitelist is nil or if the user does not exist.
func (SoftWhitelist) Get ¶ added in v1.4.0
func (s SoftWhitelist) Get(username string) []string
Get retrieves the list of networks associated with the specified username from the SoftWhitelist. If the SoftWhitelist is nil or the username does not exist, it returns nil.
func (SoftWhitelist) HasSoftWhitelist ¶ added in v1.4.0
func (s SoftWhitelist) HasSoftWhitelist() bool
HasSoftWhitelist checks if the SoftWhitelist is non-nil and contains at least one entry.
func (SoftWhitelist) Set ¶ added in v1.4.0
func (s SoftWhitelist) Set(username, network string)
Set adds a specified network to a user's whitelist if the network is valid and the username is not empty.
func (SoftWhitelist) String ¶ added in v1.4.0
func (s SoftWhitelist) String() string
type SoftWhitelistProvider ¶ added in v1.4.0
type SoftWhitelistProvider interface {
// HasSoftWhitelist checks if there is at least one entry in the soft whitelist, returning true if it exists, otherwise false.
HasSoftWhitelist() bool
// Get retrieves the list of networks associated with the given username from the soft whitelist.
Get(username string) []string
// Set adds a specified network to a user's whitelist if the network is valid and the username is not empty.
Set(username, network string)
// Delete removes a specified network from the user's soft whitelist identified by the provided username.
Delete(username, network string)
}
SoftWhitelistProvider defines the methods for managing a soft whitelist of networks associated with usernames. The interface allows checking the existence of a whitelist, retrieving, setting, and deleting networks.
type StringSet ¶
StringSet is a storage container that ensures unique keys.
func (*StringSet) GetStringSlice ¶
GetStringSlice returns all values for a StringSet as a slice of strings. Returns an empty slice if the StringSet is nil.
type TLS ¶
type TLS struct {
Enabled bool `mapstructure:"enabled"`
SkipVerify bool `mapstructure:"skip_verify"`
HTTPClientSkipVerify bool `mapstructure:"http_client_skip_verify"`
MinTLSVersion string `mapstructure:"min_tls_version" validate:"omitempty,oneof=TLS1.2 TLS1.3"`
Cert string `mapstructure:"cert" validate:"omitempty,file"`
Key string `mapstructure:"key" validate:"omitempty,file"`
CAFile string `mapstructure:"ca_file" validate:"omitempty,file"`
CipherSuites []string `mapstructure:"cipher_suites" validate:"omitempty,dive,alphanumsymbol"`
}
TLS represents the configuration for enabling TLS and managing certificates.
func (*TLS) GetCAFile ¶ added in v1.7.11
GetCAFile returns the CA certificate file path as a string. Returns an empty string if the TLS receiver is nil.
func (*TLS) GetCert ¶ added in v1.4.11
GetCert returns the TLS certificate as a string. Returns an empty string if the TLS is nil.
func (*TLS) GetCipherSuites ¶ added in v1.7.11
GetCipherSuites returns the list of configured cipher suites as a slice of strings. Returns an empty slice if the TLS is nil.
func (*TLS) GetHTTPClientSkipVerify ¶ added in v1.4.11
GetHTTPClientSkipVerify returns the value of the HTTPClientSkipVerify field, indicating whether TLS verification is skipped. Returns false if the TLS is nil. Deprecated: Use GetSkipVerify() instead
func (*TLS) GetKey ¶ added in v1.4.11
GetKey returns the TLS key as a string. Returns an empty string if the TLS is nil.
func (*TLS) GetMinTLSVersion ¶ added in v1.7.11
GetMinTLSVersion returns the minimum TLS version configured. Defaults to "TLS1.2" if unset or if the receiver is nil.
func (*TLS) GetSkipVerify ¶ added in v1.7.11
GetSkipVerify returns the value of the SkipVerify field, indicating whether TLS certificate verification is skipped. Returns false if the TLS receiver is nil.
type Tolerate ¶ added in v1.5.1
type Tolerate struct {
IPAddress string `mapstructure:"ip_address" validate:"required,ip_addr|cidr"`
ToleratePercent uint8 `mapstructure:"tolerate_percent" validate:"required,min=0,max=100"`
TolerateTTL time.Duration `mapstructure:"tolerate_ttl" validate:"required,gt=0,max=8760h"`
AdaptiveToleration bool `mapstructure:"adaptive_toleration"`
MinToleratePercent uint8 `mapstructure:"min_tolerate_percent" validate:"omitempty,min=0,max=100"`
MaxToleratePercent uint8 `mapstructure:"max_tolerate_percent" validate:"omitempty,min=0,max=100"`
ScaleFactor float64 `mapstructure:"scale_factor" validate:"omitempty,min=0.1,max=10"`
}
Tolerate represents a configuration item for toleration settings based on IP, percentage, and Time-to-Live (TTL).
func (*Tolerate) GetAdaptiveToleration ¶ added in v1.7.7
GetAdaptiveToleration checks if adaptive toleration is enabled in the Tolerate configuration. Returns false if the Tolerate is nil.
func (*Tolerate) GetIPAddress ¶ added in v1.7.7
GetIPAddress retrieves the IP address from the Tolerate configuration. Returns an empty string if the Tolerate is nil.
func (*Tolerate) GetMaxToleratePercent ¶ added in v1.7.7
GetMaxToleratePercent retrieves the maximum tolerate percent value from the Tolerate configuration. Returns 50 as default if not set or if the Tolerate is nil.
func (*Tolerate) GetMinToleratePercent ¶ added in v1.7.7
GetMinToleratePercent retrieves the minimum tolerate percent value from the Tolerate configuration. Returns 10 as default if not set or if the Tolerate is nil.
func (*Tolerate) GetScaleFactor ¶ added in v1.7.7
GetScaleFactor retrieves the scale factor value from the Tolerate configuration. Returns 1.0 as default if not set or if the Tolerate is nil.
func (*Tolerate) GetToleratePercent ¶ added in v1.7.7
GetToleratePercent retrieves the tolerate percent value from the Tolerate configuration. Returns 0 if the Tolerate is nil.
func (*Tolerate) GetTolerateTTL ¶ added in v1.7.7
GetTolerateTTL retrieves the tolerate TTL duration from the Tolerate configuration. Returns 0 if the Tolerate is nil.
type Verbosity ¶
type Verbosity struct {
// contains filtered or unexported fields
}
Verbosity is a type that represents the verbosity details.
func (*Verbosity) Set ¶
Set updates the verbosity level and name based on the provided value. It returns an error if the value is not valid. Valid values for the verbosity level are "none", "error", "warn", "info", and "debug". If the value is valid, the verboseLevel and name fields are updated accordingly. An error of type ErrWrongVerboseLevel is returned if the value is not valid.