Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitConfigFromFileOrEnv ¶
func InitConfigFromFileOrEnv(file string)
InitConfigFromFileOrEnv - Init the configuration in sequence: from a YAML file, from environment variables, then defaults.
Types ¶
type Cache ¶
type Cache struct {
Host string `yaml:"host"`
Port string `yaml:"port"`
Password string `yaml:"password"`
DB int `yaml:"db"`
TTL int `yaml:"ttl"`
AllowedStatuses []int `yaml:"allowed_statuses"`
AllowedMethods []string `yaml:"allowed_methods"`
}
Cache - Defines the config for the cache backend
type Configuration ¶
type Configuration struct {
Server Server `yaml:"server"`
Cache Cache `yaml:"cache"`
CircuitBreaker circuitbreaker.CircuitBreaker `yaml:"circuit_breaker"`
Domains Domains `yaml:"domains"`
Log Log `yaml:"log"`
}
Configuration - Defines the server configuration
var Config Configuration = Configuration{ Server: Server{ Port: Port{ HTTP: "80", HTTPS: "443", }, TLS: TLS{ Auto: false, Email: "", CertFile: "", KeyFile: "", Override: &tls.Config{ CurvePreferences: []tls.CurveID{ tls.CurveP256, }, MinVersion: tls.VersionTLS12, MaxVersion: tls.VersionTLS13, CipherSuites: []uint16{ tls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, tls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, tls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, tls.TLS_AES_128_GCM_SHA256, tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, tls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, }, }, }, Timeout: Timeout{ Read: 5 * time.Second, ReadHeader: 2 * time.Second, Write: 5 * time.Second, Idle: 20 * time.Second, Handler: 5 * time.Second, }, Upstream: Upstream{ HTTP2HTTPS: false, InsecureBridge: false, RedirectStatusCode: 301, }, GZip: false, Healthcheck: true, }, Cache: Cache{ Port: "6379", DB: 0, TTL: 0, AllowedStatuses: []int{200, 301, 302}, AllowedMethods: []string{"HEAD", "GET"}, }, CircuitBreaker: circuitbreaker.CircuitBreaker{ Threshold: 2, FailureRate: 0.5, Interval: 0, Timeout: 60 * time.Second, MaxRequests: 1, }, Log: Log{ TimeFormat: "2006/01/02 15:04:05", Format: `$host - $remote_addr - $remote_user $protocol $request_method "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" $cached_status`, }, }
Config - Holds the server configuration
func CopyOverWith ¶
func CopyOverWith(base Configuration, overrides Configuration, file *string) Configuration
CopyOverWith - Copies the Configuration over another (preserving not defined settings).
func DomainConf ¶
func DomainConf(domain string, scheme string) *Configuration
DomainConf - Returns the configuration for the requested domain.
type Server ¶
type Server struct {
Port Port `yaml:"port"`
TLS TLS `yaml:"tls"`
Timeout Timeout `yaml:"timeout"`
Upstream Upstream `yaml:"upstream"`
GZip bool `yaml:"gzip"`
Healthcheck bool `yaml:"healthcheck"`
}
Server - Defines basic info for the server
type TLS ¶
type TLS struct {
Auto bool `yaml:"auto"`
Email string `yaml:"email"`
CertFile string `yaml:"cert_file"`
KeyFile string `yaml:"key_file"`
Override *tls.Config `yaml:"override"`
}
TLS - Defines the configuration for SSL/TLS
type Timeout ¶
type Timeout struct {
Read time.Duration `yaml:"read"`
ReadHeader time.Duration `yaml:"read_header"`
Write time.Duration `yaml:"write"`
Idle time.Duration `yaml:"idle"`
Handler time.Duration `yaml:"handler"`
}
Timeout - Defines the server timeouts
type Upstream ¶
type Upstream struct {
Host string `yaml:"host"`
Port string `yaml:"port"`
Scheme string `yaml:"scheme"`
Endpoints []string `yaml:"endpoints"`
InsecureBridge bool `yaml:"insecure_bridge"`
HTTP2HTTPS bool `yaml:"http_to_https"`
RedirectStatusCode int `yaml:"redirect_status_code"`
}
Upstream - Defines the upstream settings
Click to show internal directories.
Click to hide internal directories.