Documentation ¶
Index ¶
- Constants
- Variables
- func VersionInfo() string
- type API
- type AcceptancePolicy
- type Client
- type CompatibilityPolicy
- type Config
- func (c *Config) InitConfig(ctx context.Context)
- func (c *Config) LoadDefaults(ctx context.Context)
- func (c *Config) LoadGlobalConfigFile(ctx context.Context)
- func (c *Config) LoadGlobalEnvVars(ctx context.Context)
- func (c *Config) LoadPluginConfigFile(ctx context.Context)
- func (c *Config) LoadPluginEnvVars(ctx context.Context)
- func (c *Config) MergeGlobalConfig(ctx context.Context, updatedGlobalConfig map[string]interface{})
- func (c *Config) UnmarshalGlobalConfig(ctx context.Context)
- func (c *Config) UnmarshalPluginConfig(ctx context.Context)
- 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_" TracerName = "gatewayd" // Logger constants. DefaultLogOutput = "console" 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" DefaultSyslogPriority = "info" // Plugin constants. DefaultMinPort = 50000 DefaultMaxPort = 60000 PluginPriorityStart = 1000 LoggerName = "plugin" DefaultPluginAddress = "http://plugins/metrics" DefaultMetricsMergerPeriod = 5 * time.Second DefaultPluginHealthCheckPeriod = 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 // API constants. DefaultHTTPAPIAddress = "localhost:8080" DefaultGRPCAPINetwork = "tcp" DefaultGRPCAPIAddress = "localhost:9090" )
const Name = "GatewayD"
Variables ¶
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) InitConfig ¶ added in v0.4.5
func (*Config) LoadDefaults ¶ added in v0.3.1
LoadDefaults loads the default configuration before loading the config files.
func (*Config) LoadGlobalConfigFile ¶ added in v0.3.1
LoadGlobalConfig loads the plugin configuration file.
func (*Config) LoadGlobalEnvVars ¶ added in v0.3.1
LoadGlobalEnvVars loads the environment variables into the global configuration with the given prefix, "GATEWAYD_".
func (*Config) LoadPluginConfigFile ¶ added in v0.3.1
LoadPluginConfig loads the plugin configuration file.
func (*Config) LoadPluginEnvVars ¶ added in v0.3.1
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
UnmarshalGlobalConfig unmarshals the global configuration for easier access.
func (*Config) UnmarshalPluginConfig ¶ added in v0.3.1
UnmarshalPluginConfig unmarshals the plugin configuration for easier access.
type GlobalConfig ¶
type GlobalConfig struct { API API `koanf:"api"` Loggers map[string]Logger `koanf:"loggers"` Clients map[string]Client `koanf:"clients"` Pools map[string]Pool `koanf:"pools"` Proxies map[string]Proxy `koanf:"proxies"` Servers map[string]Server `koanf:"servers"` Metrics map[string]Metrics `koanf:"metrics"` }
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"` EnableMetricsMerger bool `koanf:"enableMetricsMerger"` MetricsMergerPeriod time.Duration `koanf:"metricsMergerPeriod"` HealthCheckPeriod time.Duration `koanf:"healthCheckPeriod"` ReloadOnCrash bool `koanf:"reloadOnCrash"` 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) GetPlugins ¶ added in v0.5.2
func (p PluginConfig) GetPlugins(name ...string) []Plugin
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.