-
Notifications
You must be signed in to change notification settings - Fork 16
/
constants.go
137 lines (119 loc) · 4.05 KB
/
constants.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package config
import (
"time"
)
type (
Status uint
VerificationPolicy string
CompatibilityPolicy string
AcceptancePolicy string
TerminationPolicy string
LogOutput uint
)
// Status is the status of the server.
const (
Running Status = iota
Stopped
)
// VerificationPolicy is the policy for hook verification.
const (
// Non-strict (permissive) mode.
PassDown VerificationPolicy = "passdown" // Pass down the extra keys/values in result to the next plugins
// Strict mode.
Ignore VerificationPolicy = "ignore" // Ignore errors and continue
Abort VerificationPolicy = "abort" // Abort on first error and return results
Remove VerificationPolicy = "remove" // Remove the hook from the list on error and continue
)
// CompatibilityPolicy is the compatibility policy for plugins.
const (
Strict CompatibilityPolicy = "strict" // Expect all required plugins to be loaded and present
Loose CompatibilityPolicy = "loose" // Load the plugin, even if the requirements are not met
)
// AcceptancePolicy is the acceptance policy for custom hooks.
const (
Accept AcceptancePolicy = "accept" // Accept all custom hooks
Reject AcceptancePolicy = "reject" // Reject all custom hooks
)
// TerminationPolicy is the termination policy for
// the functions registered to the OnTrafficFromClient hook.
const (
Continue TerminationPolicy = "continue" // Continue to the next function
Stop TerminationPolicy = "stop" // Stop the execution of the functions
)
// LogOutput is the output type for the logger.
const (
Console LogOutput = iota
Stdout
Stderr
File
Syslog
RSyslog
)
const (
// Config constants.
Default = "default"
EnvPrefix = "GATEWAYD_"
TracerName = "gatewayd"
GlobalConfigFilename = "gatewayd.yaml"
PluginsConfigFilename = "gatewayd_plugins.yaml"
// Logger constants.
DefaultLogOutput = "console"
DefaultLogFileName = "gatewayd.log"
DefaultLogLevel = "info"
DefaultNoColor = false
DefaultTimeFormat = "unix"
DefaultConsoleTimeFormat = "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
DefaultPluginTimeout = 30 * time.Second
// Client constants.
DefaultNetwork = "tcp"
DefaultAddress = "localhost:5432"
DefaultChunkSize = 8192
DefaultReceiveDeadline = 0 // 0 means no deadline (timeout)
DefaultSendDeadline = 0
DefaultTCPKeepAlivePeriod = 30 * time.Second
DefaultTCPKeepAlive = false
// 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 << 27 // 134217728 bytes
DefaultTCPKeepAliveDuration = 3 * time.Second
DefaultLoadBalancer = "roundrobin"
DefaultTCPNoDelay = true
// Utility constants.
DefaultSeed = 1000
ChecksumBufferSize = 65536
// Metrics constants.
DefaultMetricsAddress = "localhost:9090"
DefaultMetricsPath = "/metrics"
// Sentry constants.
DefaultTraceSampleRate = 0.2
DefaultAttachStacktrace = true
DefaultFlushTimeout = 2 * time.Second
// API constants.
DefaultHTTPAPIAddress = "localhost:18080"
DefaultGRPCAPINetwork = "tcp"
DefaultGRPCAPIAddress = "localhost:19090"
)