Documentation ¶
Index ¶
- Constants
- Variables
- func VersionInfo() string
- type AcceptancePolicy
- type Client
- type CompatibilityPolicy
- type Config
- func (c *Config) LoadDefaults()
- func (c *Config) LoadGlobalConfigFile()
- func (c *Config) LoadGlobalEnvVars()
- func (c *Config) LoadPluginConfigFile()
- func (c *Config) LoadPluginEnvVars()
- func (c *Config) MergeGlobalConfig(updatedGlobalConfig map[string]interface{})
- func (c *Config) UnmarshalGlobalConfig()
- func (c *Config) UnmarshalPluginConfig()
- type GlobalConfig
- type IConfig
- type LogOutput
- type Logger
- type Metrics
- type Plugin
- type PluginConfig
- type Pool
- type Proxy
- type Server
- type Status
- type VerificationPolicy
Constants ¶
const ( // Config constants. Default = "default" EnvPrefix = "GATEWAYD_" // Logger constants. DefaultLogFileName = "gatewayd.log" DefaultLogLevel = "info" DefaultTimeFormat = zerolog.TimeFormatUnix DefaultConsoleTimeFormat = time.RFC3339 DefaultMaxSize = 500 // megabytes DefaultMaxBackups = 5 DefaultMaxAge = 30 // days DefaultCompress = true DefaultLocalTime = false DefaultSyslogTag = "gatewayd" DefaultRSyslogNetwork = "tcp" DefaultRSyslogAddress = "localhost:514" // Plugin constants. DefaultMinPort = 50000 DefaultMaxPort = 60000 PluginPriorityStart = 1000 LoggerName = "plugin" DefaultPluginAddress = "http://plugins/metrics" DefaultMetricsMergerPeriod = 5 * time.Second // Client constants. DefaultChunkSize = 4096 DefaultReceiveDeadline = 0 // 0 means no deadline (timeout) DefaultSendDeadline = 0 DefaultTCPKeepAlivePeriod = 30 * time.Second // Pool constants. EmptyPoolCapacity = 0 DefaultPoolSize = 10 MinimumPoolSize = 2 DefaultHealthCheckPeriod = 60 * time.Second // This must match PostgreSQL authentication timeout. // Server constants. DefaultListenNetwork = "tcp" DefaultListenAddress = "0.0.0.0:15432" DefaultTickInterval = 5 * time.Second DefaultBufferSize = 1 << 24 // 16777216 bytes DefaultTCPKeepAlive = 3 * time.Second DefaultLoadBalancer = "roundrobin" // Utility constants. DefaultSeed = 1000 ChecksumBufferSize = 65536 // Metrics constants. DefaultMetricsAddress = "localhost:2112" DefaultMetricsPath = "/metrics" // Sentry constants. DefaultTraceSampleRate = 0.2 DefaultAttachStacktrace = true DefaultFlushTimeout = 2 * time.Second )
const Name = "GatewayD"
Variables ¶
var ( DefaultLogOutput = [...]string{"console"} DefaultSyslogPriority = syslog.LOG_LOCAL0 | syslog.LOG_DEBUG //nolint:nosnakecase )
var ( // Version is the semantic version of GatewayD. Version = "" // VersionDetails is the build timestamp and the tagged commit hash. VersionDetails = "" )
Functions ¶
func VersionInfo ¶ added in v0.3.1
func VersionInfo() string
VersionInfo returns the full version and build information for the currently running GatewayD executable.
Types ¶
type AcceptancePolicy ¶ added in v0.2.4
type AcceptancePolicy uint
const ( Accept AcceptancePolicy = iota // Accept all custom hooks Reject // Reject all custom hooks )
AcceptancePolicy is the acceptance policy for custom hooks.
type Client ¶
type Client struct { Network string `koanf:"network"` Address string `koanf:"address"` TCPKeepAlive bool `koanf:"tcpKeepAlive"` TCPKeepAlivePeriod time.Duration `koanf:"tcpKeepAlivePeriod"` ReceiveBufferSize int `koanf:"receiveBufferSize"` ReceiveChunkSize int `koanf:"receiveChunkSize"` ReceiveDeadline time.Duration `koanf:"receiveDeadline"` SendDeadline time.Duration `koanf:"sendDeadline"` }
type CompatibilityPolicy ¶ added in v0.2.4
type CompatibilityPolicy uint
const ( Strict CompatibilityPolicy = iota // Expect all required plugins to be loaded and present Loose // Load the plugin, even if the requirements are not met )
CompatibilityPolicy is the compatibility policy for plugins.
type Config ¶ added in v0.3.1
type Config struct { GlobalKoanf *koanf.Koanf PluginKoanf *koanf.Koanf Global GlobalConfig Plugin PluginConfig // contains filtered or unexported fields }
func (*Config) LoadDefaults ¶ added in v0.3.1
func (c *Config) LoadDefaults()
LoadDefaults loads the default configuration before loading the config files.
func (*Config) LoadGlobalConfigFile ¶ added in v0.3.1
func (c *Config) LoadGlobalConfigFile()
LoadGlobalConfig loads the plugin configuration file.
func (*Config) LoadGlobalEnvVars ¶ added in v0.3.1
func (c *Config) LoadGlobalEnvVars()
LoadGlobalEnvVars loads the environment variables into the global configuration with the given prefix, "GATEWAYD_".
func (*Config) LoadPluginConfigFile ¶ added in v0.3.1
func (c *Config) LoadPluginConfigFile()
LoadPluginConfig loads the plugin configuration file.
func (*Config) LoadPluginEnvVars ¶ added in v0.3.1
func (c *Config) LoadPluginEnvVars()
LoadPluginEnvVars loads the environment variables into the plugins configuration with the given prefix, "GATEWAYD_".
func (*Config) MergeGlobalConfig ¶ added in v0.3.1
func (*Config) UnmarshalGlobalConfig ¶ added in v0.3.1
func (c *Config) UnmarshalGlobalConfig()
UnmarshalGlobalConfig unmarshals the global configuration for easier access.
func (*Config) UnmarshalPluginConfig ¶ added in v0.3.1
func (c *Config) UnmarshalPluginConfig()
UnmarshalPluginConfig unmarshals the plugin configuration for easier access.
type GlobalConfig ¶
type IConfig ¶ added in v0.3.1
type IConfig interface { LoadDefaults() LoadPluginEnvVars() LoadGlobalEnvVars() LoadGlobalConfigFile() LoadPluginConfigFile() MergeGlobalConfig(map[string]interface{}) }
type Logger ¶
type Logger struct { Output []string `koanf:"output"` TimeFormat string `koanf:"timeFormat"` Level string `koanf:"level"` ConsoleTimeFormat string `koanf:"consoleTimeFormat"` NoColor bool `koanf:"noColor"` FileName string `koanf:"fileName"` MaxSize int `koanf:"maxSize"` MaxBackups int `koanf:"maxBackups"` MaxAge int `koanf:"maxAge"` Compress bool `koanf:"compress"` LocalTime bool `koanf:"localTime"` RSyslogNetwork string `koanf:"rSyslogNetwork"` RSyslogAddress string `koanf:"rSyslogAddress"` SyslogPriority string `koanf:"syslogPriority"` }
func (Logger) GetConsoleTimeFormat ¶ added in v0.3.2
GetConsoleTimeFormat returns the console logger's time format from config file.
func (Logger) GetSyslogPriority ¶ added in v0.3.2
GetSyslogPriority returns the rsyslog facility from config file.
func (Logger) GetTimeFormat ¶
GetTimeFormat returns the logger time format from config file.
type PluginConfig ¶
type PluginConfig struct { VerificationPolicy string `koanf:"verificationPolicy"` CompatibilityPolicy string `koanf:"compatibilityPolicy"` AcceptancePolicy string `koanf:"acceptancePolicy"` MetricsMergerPeriod time.Duration `koanf:"metricsMergerPeriod"` Plugins []Plugin `koanf:"plugins"` }
func (PluginConfig) GetAcceptancePolicy ¶ added in v0.2.4
func (p PluginConfig) GetAcceptancePolicy() AcceptancePolicy
GetAcceptancePolicy returns the acceptance policy from plugin config file.
func (PluginConfig) GetPluginCompatibilityPolicy ¶ added in v0.2.4
func (p PluginConfig) GetPluginCompatibilityPolicy() CompatibilityPolicy
GetPluginCompatibilityPolicy returns the plugin compatibility policy from plugin config file.
func (PluginConfig) GetVerificationPolicy ¶
func (p PluginConfig) GetVerificationPolicy() VerificationPolicy
GetVerificationPolicy returns the hook verification policy from plugin config file.
type Server ¶
type Server struct { EnableTicker bool `koanf:"enableTicker"` MultiCore bool `koanf:"multiCore"` LockOSThread bool `koanf:"lockOSThread"` ReuseAddress bool `koanf:"reuseAddress"` ReusePort bool `koanf:"reusePort"` TCPNoDelay bool `koanf:"tcpNoDelay"` ReadBufferCap int `koanf:"readBufferCap"` WriteBufferCap int `koanf:"writeBufferCap"` SocketRecvBuffer int `koanf:"socketRecvBuffer"` SocketSendBuffer int `koanf:"socketSendBuffer"` SoftLimit uint64 `koanf:"softLimit"` HardLimit uint64 `koanf:"hardLimit"` TCPKeepAlive time.Duration `koanf:"tcpKeepAlive"` TickInterval time.Duration `koanf:"tickInterval"` Network string `koanf:"network"` Address string `koanf:"address"` LoadBalancer string `koanf:"loadBalancer"` }
func (Server) GetLoadBalancer ¶
func (s Server) GetLoadBalancer() gnet.LoadBalancing
GetLoadBalancer returns the load balancing algorithm to use.
func (Server) GetTCPNoDelay ¶
func (s Server) GetTCPNoDelay() gnet.TCPSocketOpt
GetTCPNoDelay returns the TCP no delay option from config file.
type VerificationPolicy ¶ added in v0.2.4
type VerificationPolicy uint
const ( // Non-strict (permissive) mode. PassDown VerificationPolicy = iota // Pass down the extra keys/values in result to the next plugins // Strict mode. Ignore // Ignore errors and continue Abort // Abort on first error and return results Remove // Remove the hook from the list on error and continue )
Policy is the policy for hook verification.