Documentation
¶
Index ¶
- Variables
- func ReloadConfigFile() (err error)
- func SetTestEnvironmentConfig(env Environment)
- func SetTestFile(testFile File)
- type Backend
- type BackendServer
- type BackendServerMonitoring
- type BasicAuth
- type BruteForceRule
- type BruteForceSection
- func (b *BruteForceSection) GetCustomTolerations() []Tolerate
- func (s *BruteForceSection) GetNeuralNetwork() *NeuralNetwork
- 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) GetUsername() string
- func (c *Cluster) GetWriteTimeout() time.Duration
- 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) 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) IsCustomHooksDisabled() bool
- type Environment
- type EnvironmentSettings
- func (env *EnvironmentSettings) GetDevMode() bool
- func (env *EnvironmentSettings) GetExperimentalML() 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() (rules []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) 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) 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) 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
- 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 LDAPAttributeMapping
- type LDAPConf
- 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) 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
- type Master
- type MasterUser
- type NeuralNetwork
- 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) 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) 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
- type Verbosity
Constants ¶
This section is empty.
Variables ¶
var ( Matcher language.Matcher DefaultLanguageTags []language.Tag )
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) String ¶
func (n *BackendServer) String() string
type BackendServerMonitoring ¶
type BackendServerMonitoring struct {
BackendServers []*BackendServer `mapstructure:"backend_servers" validate:"required,dive"`
}
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,alphanumunicode,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.
func (*BasicAuth) GetUsername ¶ added in v1.4.11
GetUsername returns the username configured for basic HTTP authentication.
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"`
}
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) 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"`
NeuralNetwork NeuralNetwork `mapstructure:"neural_network" validate:"omitempty"`
}
func (*BruteForceSection) GetCustomTolerations ¶ added in v1.5.1
func (b *BruteForceSection) GetCustomTolerations() []Tolerate
GetCustomTolerations returns the CustomTolerations slice from the BruteForceSection. Returns nil if the receiver is nil.
func (*BruteForceSection) GetNeuralNetwork ¶ added in v1.6.0
func (s *BruteForceSection) GetNeuralNetwork() *NeuralNetwork
GetNeuralNetwork retrieves a pointer to the NeuralNetwork configuration from the ServerSection instance.
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"`
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.
func (*Cluster) GetMaxRedirects ¶ added in v1.7.1
GetMaxRedirects returns the maximum number of redirects to follow.
func (*Cluster) GetPassword ¶ added in v1.4.11
GetPassword retrieves the password configured for the Redis cluster.
func (*Cluster) GetReadOnly ¶ added in v1.7.1
GetReadOnly returns whether read-only commands should be allowed from replicas.
func (*Cluster) GetReadTimeout ¶ added in v1.7.1
GetReadTimeout returns the timeout for read operations.
func (*Cluster) GetRouteByLatency ¶ added in v1.7.1
GetRouteByLatency returns whether commands should be routed to the closest node.
func (*Cluster) GetRouteRandomly ¶ added in v1.7.1
GetRouteRandomly returns whether commands should be routed randomly across nodes.
func (*Cluster) GetUsername ¶ added in v1.4.11
GetUsername retrieves the username configured for the Redis cluster.
func (*Cluster) GetWriteTimeout ¶ added in v1.7.1
GetWriteTimeout returns the timeout for write operations.
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.
func (*DNS) GetResolver ¶ added in v1.4.11
GetResolver returns the configured DNS resolver address as a string.
func (*DNS) GetTimeout ¶ added in v1.4.11
GetTimeout returns the timeout duration configured for the DNS resolver.
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= "`
}
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.
func (*DefaultHTTPRequestHeader) GetClientHost ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetClientHost() string
GetClientHost retrieves the client host value from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetClientID ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetClientID() string
GetClientID retrieves the client identifier from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetClientIP ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetClientIP() string
GetClientIP retrieves the client's IP address from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetClientPort ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetClientPort() string
GetClientPort retrieves the client port value from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetLocalIP ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetLocalIP() string
GetLocalIP retrieves the local IP address from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetLocalPort ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetLocalPort() string
GetLocalPort retrieves the local port value from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetLoginAttempt ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetLoginAttempt() string
GetLoginAttempt retrieves the login attempt value from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetPassword ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetPassword() string
GetPassword retrieves the password value from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetPasswordEncoded ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetPasswordEncoded() string
GetPasswordEncoded retrieves the encoded password value from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetProtocol ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetProtocol() string
GetProtocol retrieves the protocol value from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetSSL ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSL() string
GetSSL retrieves the SSL value from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetSSLCipher ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLCipher() string
GetSSLCipher retrieves the SSL cipher value from the DefaultHTTPRequestHeader struct.
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.
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.
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.
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.
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.
func (*DefaultHTTPRequestHeader) GetSSLFingerprint ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLFingerprint() string
GetSSLFingerprint retrieves the SSL fingerprint value from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetSSLIssuer ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLIssuer() string
GetSSLIssuer retrieves the SSL issuer value from the DefaultHTTPRequestHeader struct.
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.
func (*DefaultHTTPRequestHeader) GetSSLProtocol ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLProtocol() string
GetSSLProtocol retrieves the SSL protocol value from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetSSLSerial ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLSerial() string
GetSSLSerial retrieves the SSL serial number from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetSSLSessionID ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLSessionID() string
GetSSLSessionID retrieves the SSL session ID from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetSSLSubject ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLSubject() string
GetSSLSubject retrieves the SSL subject value from the DefaultHTTPRequestHeader struct.
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.
func (*DefaultHTTPRequestHeader) GetSSLVerify ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetSSLVerify() string
GetSSLVerify retrieves the SSL verification setting from the DefaultHTTPRequestHeader struct.
func (*DefaultHTTPRequestHeader) GetUsername ¶ added in v1.4.11
func (d *DefaultHTTPRequestHeader) GetUsername() string
GetUsername retrieves the username value from the DefaultHTTPRequestHeader struct.
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"`
}
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.
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.
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.
func (*Endpoint) IsAuthJWTDisabled ¶ added in v1.7.0
IsAuthJWTDisabled checks if JWT authentication is enabled for the endpoint and returns the corresponding boolean value.
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.
func (*Endpoint) IsAuthSASLAuthdDisabled ¶ added in v1.7.0
IsAuthSASLAuthdDisabled checks if SASL authentication is enabled for the endpoint and returns the corresponding boolean value.
func (*Endpoint) IsCustomHooksDisabled ¶ added in v1.7.0
IsCustomHooksDisabled checks if custom hooks are enabled for the endpoint and returns the corresponding boolean value.
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
// GetExperimentalML indicates whether experimental machine learning features are enabled.
GetExperimentalML() 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
// ExperimentalML indicates whether experimental machine learning features are enabled within the application.
ExperimentalML 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) GetExperimentalML ¶ added in v1.6.0
func (env *EnvironmentSettings) GetExperimentalML() bool
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
// 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
// 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
// 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.
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 nil 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.
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() (rules []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 nil.
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) 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 nil 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.
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.
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 nil 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. Accepts a string representing the protocol to search for.
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 nil 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 the Lua initialization script path is 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 the InitScriptPath is not empty, 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 nil.
type Frontend ¶ added in v1.1.0
type Frontend struct {
Enabled bool `mapstructure:"enabled"`
CSRFSecret string `mapstructure:"csrf_secret" validate:"omitempty,len=32,alphanumunicode,excludesall= "`
CookieStoreAuthKey string `mapstructure:"cookie_store_auth_key" validate:"omitempty,len=32,alphanumunicode,excludesall= "`
CookieStoreEncKey string `mapstructure:"cookie_store_encryption_key" validate:"omitempty,alphanumunicode,excludesall= ,validateCookieStoreEncKey"`
}
Frontend represents configuration options for the frontend of the application.
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"`
}
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.
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.
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.
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.
func (*HTTPClient) GetProxy ¶ added in v1.4.11
func (c *HTTPClient) GetProxy() string
GetProxy returns the proxy URL configured for the HTTP client.
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) String ¶
func (i *IdTokenClaims) String() string
type Insights ¶
type Insights struct {
EnablePprof bool `mapstructure:"enable_pprof"`
EnableBlockProfile bool `mapstructure:"enable_block_profile"`
}
Insights is a configuration structure for enabling profiling and block profiling capabilities.
func (*Insights) IsBlockProfileEnabled ¶ added in v1.4.11
IsBlockProfileEnabled checks if block profiling is enabled in the Insights configuration.
func (*Insights) IsPprofEnabled ¶ added in v1.4.11
IsPprofEnabled checks if pprof profiling is enabled in the Insights configuration.
type JWTAuth ¶ added in v1.7.0
type JWTAuth struct {
Enabled bool `mapstructure:"enabled"`
SecretKey string `mapstructure:"secret_key" validate:"omitempty,min=32,alphanumunicode,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.
func (*JWTAuth) GetSecretKey ¶ added in v1.7.0
GetSecretKey returns the secret key used for JWT signing.
func (*JWTAuth) GetTokenExpiry ¶ added in v1.7.0
GetTokenExpiry returns the token expiry duration.
func (*JWTAuth) IsEnabled ¶ added in v1.7.0
IsEnabled returns true if JWT authentication is enabled, otherwise false.
func (*JWTAuth) IsRefreshTokenEnabled ¶ added in v1.7.0
IsRefreshTokenEnabled returns true if refresh tokens are enabled.
func (*JWTAuth) IsStoreInRedisEnabled ¶ added in v1.7.0
IsStoreInRedisEnabled returns true if tokens should be stored in Redis.
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.
func (*JWTUser) GetUsername ¶ added in v1.7.0
GetUsername returns the username of the JWT user.
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"`
}
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) GetNumberOfWorkers ¶ added in v1.6.5
GetNumberOfWorkers returns the number of workers configured in the LDAPConf. Returns 0 if the LDAPConf is nil.
type LDAPFilter ¶
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) 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 nil if the receiver is nil.
func (*LDAPSection) GetProtocols ¶
func (l *LDAPSection) GetProtocols() any
GetProtocols returns the search protocols of the LDAP configuration, or nil 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.
func (*Log) GetLogLevel ¶ added in v1.4.11
GetLogLevel returns the name of the current logging level configured in the Log instance.
func (*Log) GetLogLevelName ¶ added in v1.4.11
GetLogLevelName returns the name of the current logging level as a string.
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.
func (*Log) IsLogUsesColor ¶ added in v1.4.11
IsLogUsesColor determines if colored output is enabled for logging.
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.
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"`
}
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.
type LuaFeature ¶
type LuaFeature struct {
Name string `mapstructure:"name" validate:"required"`
ScriptPath string `mapstructure:"script_path" validate:"required,file"`
}
func (*LuaFeature) String ¶
func (l *LuaFeature) String() string
type LuaFilter ¶
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=GET POST PUT DELETE PATCH"`
ScriptPath string `mapstructure:"script_path" validate:"required,file"`
Roles []string `mapstructure:"roles"`
}
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.
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) GetConfig ¶
func (l *LuaSection) GetConfig() any
GetConfig retrieves the `Config` field from the LuaSection. Returns nil 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 nil if the LuaSection is nil.
func (*LuaSection) GetProtocols ¶
func (l *LuaSection) GetProtocols() any
GetProtocols retrieves the search protocols from the LuaSection. Returns nil 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.
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.
type NeuralNetwork ¶ added in v1.6.0
type NeuralNetwork struct {
MaxTrainingRecords int32 `mapstructure:"max_training_records" validate:"omitempty,gte=1000,lte=100000"`
HiddenNeurons int `mapstructure:"hidden_neurons" validate:"omitempty,min=8,max=20"`
ActivationFunction string `mapstructure:"activation_function" validate:"omitempty,oneof=sigmoid tanh relu leaky_relu"`
StaticWeight float64 `mapstructure:"static_weight" validate:"omitempty,min=0,max=1"`
MLWeight float64 `mapstructure:"ml_weight" validate:"omitempty,min=0,max=1"`
Threshold float64 `mapstructure:"threshold" validate:"omitempty,min=0,max=1"`
LearningRate float64 `mapstructure:"learning_rate" validate:"omitempty,min=0.001,max=0.1"`
}
NeuralNetwork represents the configuration for the neural network machine learning system.
func (*NeuralNetwork) GetLearningRate ¶ added in v1.7.2
func (n *NeuralNetwork) GetLearningRate() float64
GetLearningRate retrieves the learning rate for the neural network. Returns 0.01 as default if not set.
func (*NeuralNetwork) GetMLWeight ¶ added in v1.7.2
func (n *NeuralNetwork) GetMLWeight() float64
GetMLWeight retrieves the weight for ML in the weighted decision. Returns 0.6 as default if not set.
func (*NeuralNetwork) GetMaxTrainingRecords ¶ added in v1.6.0
func (n *NeuralNetwork) GetMaxTrainingRecords() int32
GetMaxTrainingRecords retrieves the maximum number of training records to keep for the neural network.
func (*NeuralNetwork) GetStaticWeight ¶ added in v1.7.2
func (n *NeuralNetwork) GetStaticWeight() float64
GetStaticWeight retrieves the weight for static rules in the weighted decision. Returns 0.4 as default if not set.
func (*NeuralNetwork) GetThreshold ¶ added in v1.7.2
func (n *NeuralNetwork) GetThreshold() float64
GetThreshold retrieves the threshold for the weighted decision. Returns 0.7 as default if not set.
type OIDCCustomClaim ¶
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"`
}
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"`
}
type Oauth2Section ¶
type Oauth2Section struct {
CustomScopes []Oauth2CustomScope `mapstructure:"custom_scopes" validate:"omitempty,dive"`
Clients []Oauth2Client `mapstructure:"clients" validate:"omitempty,dive"`
}
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.
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.
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:"required,ip4_addr"`
Weight int `mapstructure:"weight" validate:"omitempty,min=-100,max=100"`
}
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) 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,alphanumunicode,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.
func (*Redis) GetDatabaseNumber ¶ added in v1.4.11
GetDatabaseNumber retrieves the configured database number for the Redis instance.
func (*Redis) GetIdlePoolSize ¶ added in v1.4.11
GetIdlePoolSize retrieves the number of idle connections allowed in the connection pool.
func (*Redis) GetNegCacheTTL ¶ added in v1.4.11
GetNegCacheTTL retrieves the negative cache time-to-live (TTL) duration configured for the Redis instance.
func (*Redis) GetPasswordNonce ¶ added in v1.4.11
GetPasswordNonce retrieves the password nonce configured for the Redis instance.
func (*Redis) GetPoolSize ¶ added in v1.4.11
GetPoolSize retrieves the size of the connection pool configured for the Redis instance.
func (*Redis) GetPosCacheTTL ¶ added in v1.4.11
GetPosCacheTTL retrieves the positive cache time-to-live (TTL) duration configured for the Redis instance.
func (*Redis) GetPrefix ¶ added in v1.4.11
GetPrefix retrieves the prefix associated with the Redis instance configuration.
func (*Redis) GetSentinel ¶ added in v1.4.11
GetSentinel returns a pointer to the Sentinels configuration of the Redis instance.
func (*Redis) GetStandaloneMaster ¶ added in v1.4.11
GetStandaloneMaster returns a pointer to the Master configuration of the Redis instance.
func (*Redis) GetStandaloneReplica ¶ added in v1.4.11
GetStandaloneReplica returns a pointer to the Replica configuration of the Redis instance.
type RelayDomainsSection ¶
type RelayDomainsSection struct {
SoftWhitelist `mapstructure:"soft_whitelist"`
StaticDomains []string `mapstructure:"static" validate:"required,dive,hostname"`
}
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.
func (*Sentinels) GetMasterName ¶ added in v1.4.11
GetMasterName returns the name of the master Redis instance configured in the Sentinels struct.
func (*Sentinels) GetPassword ¶ added in v1.4.11
GetPassword retrieves the password configured for the Redis Sentinel connection.
func (*Sentinels) GetUsername ¶ added in v1.4.11
GetUsername retrieves the username configured for the Redis Sentinel connection.
type ServerSection ¶
type ServerSection struct {
Address string `mapstructure:"address" validate:"omitempty,tcp_addr"`
MaxConcurrentRequests int32 `mapstructure:"max_concurrent_requests" validate:"required,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"`
}
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.
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.
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.
func (*ServerSection) GetDNS ¶ added in v1.4.11
func (s *ServerSection) GetDNS() *DNS
GetDNS retrieves the DNS configuration from the ServerSection instance.
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.
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.
func (*ServerSection) GetFeatures ¶ added in v1.4.11
func (s *ServerSection) GetFeatures() []*Feature
GetFeatures retrieves the list of features configured in the ServerSection instance.
func (*ServerSection) GetHTTPClient ¶ added in v1.4.11
func (s *ServerSection) GetHTTPClient() *HTTPClient
GetHTTPClient retrieves the HTTP client configuration from the ServerSection instance.
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.
func (*ServerSection) GetInstanceName ¶ added in v1.4.11
func (s *ServerSection) GetInstanceName() string
GetInstanceName retrieves the instance name defined in the ServerSection configuration.
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.
func (*ServerSection) GetListenAddress ¶ added in v1.4.11
func (s *ServerSection) GetListenAddress() string
GetListenAddress retrieves the server's listen address from the ServerSection configuration.
func (*ServerSection) GetLog ¶ added in v1.4.11
func (s *ServerSection) GetLog() *Log
GetLog retrieves the logging configuration of the ServerSection instance.
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.
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.
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.
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.
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.
func (*ServerSection) GetTLS ¶ added in v1.4.11
func (s *ServerSection) GetTLS() *TLS
GetTLS retrieves the TLS configuration from the ServerSection instance.
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.
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.
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.
type TLS ¶
type TLS struct {
Enabled bool `mapstructure:"enabled"`
Cert string `mapstructure:"cert" validate:"omitempty,file"`
Key string `mapstructure:"key" validate:"omitempty,file"`
HTTPClientSkipVerify bool `mapstructure:"http_client_skip_verify"`
}
TLS represents the configuration for enabling TLS and managing certificates.
func (*TLS) GetHTTPClientSkipVerify ¶ added in v1.4.11
GetHTTPClientSkipVerify returns the value of the HTTPClientSkipVerify field, indicating whether TLS verification is skipped.
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"`
}
Tolerate represents a configuration item for toleration settings based on IP, percentage, and Time-to-Live (TTL).
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.