config

package
v0.0.0-...-2fc2a81 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2018 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, + 1 more Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOAD_BALANCE_RR           string = "round-robin"
	LOAD_BALANCE_LC           string = "least-connection"
	SHARD_ALL                 string = "all"
	SHARD_SEGMENTS            string = "segments"
	SHARD_SHARED_AND_SEGMENTS string = "shared-and-segments"
	ALWAYS_FORWARD            string = "always_forward"
	SANITIZE_SET              string = "sanitize_set"
	FORWARD                   string = "forward"
)

Variables

View Source
var AllowedForwardedClientCertModes = []string{ALWAYS_FORWARD, FORWARD, SANITIZE_SET}
View Source
var LoadBalancingStrategies = []string{LOAD_BALANCE_RR, LOAD_BALANCE_LC}

Functions

This section is empty.

Types

type AccessLog

type AccessLog struct {
	File            string `yaml:"file"`
	EnableStreaming bool   `yaml:"enable_streaming"`
}

type BackendConfig

type BackendConfig struct {
	ClientAuthCertificate tls.Certificate
	EnableTLS             bool             `yaml:"enable_tls"`
	MaxConns              int64            `yaml:"max_conns"`
	TLSPem                `yaml:",inline"` // embed to get cert_chain and private_key for client authentication
}

type Config

type Config struct {
	Status                   StatusConfig      `yaml:"status,omitempty"`
	Nats                     []NatsConfig      `yaml:"nats,omitempty"`
	Logging                  LoggingConfig     `yaml:"logging,omitempty"`
	Port                     uint16            `yaml:"port,omitempty"`
	Index                    uint              `yaml:"index,omitempty"`
	Zone                     string            `yaml:"zone,omitempty"`
	GoMaxProcs               int               `yaml:"go_max_procs,omitempty"`
	Tracing                  Tracing           `yaml:"tracing,omitempty"`
	TraceKey                 string            `yaml:"trace_key,omitempty"`
	AccessLog                AccessLog         `yaml:"access_log,omitempty"`
	EnableAccessLogStreaming bool              `yaml:"enable_access_log_streaming,omitempty"`
	DebugAddr                string            `yaml:"debug_addr,omitempty"`
	EnablePROXY              bool              `yaml:"enable_proxy,omitempty"`
	EnableSSL                bool              `yaml:"enable_ssl,omitempty"`
	SSLPort                  uint16            `yaml:"ssl_port,omitempty"`
	DisableHTTP              bool              `yaml:"disable_http,omitempty"`
	SSLCertificates          []tls.Certificate `yaml:"-"`
	TLSPEM                   []TLSPem          `yaml:"tls_pem,omitempty"`
	CACerts                  string            `yaml:"ca_certs,omitempty"`
	CAPool                   *x509.CertPool    `yaml:"-"`
	SkipSSLValidation        bool              `yaml:"skip_ssl_validation,omitempty"`
	ForwardedClientCert      string            `yaml:"forwarded_client_cert,omitempty"`
	ForceForwardedProtoHttps bool              `yaml:"force_forwarded_proto_https,omitempty"`
	SanitizeForwardedProto   bool              `yaml:"sanitize_forwarded_proto,omitempty"`
	IsolationSegments        []string          `yaml:"isolation_segments,omitempty"`
	RoutingTableShardingMode string            `yaml:"routing_table_sharding_mode,omitempty"`

	CipherString                      string             `yaml:"cipher_suites,omitempty"`
	CipherSuites                      []uint16           `yaml:"-"`
	MinTLSVersionString               string             `yaml:"min_tls_version,omitempty"`
	MinTLSVersion                     uint16             `yaml:"-"`
	ClientCertificateValidationString string             `yaml:"client_cert_validation,omitempty"`
	ClientCertificateValidation       tls.ClientAuthType `yaml:"-"`

	LoadBalancerHealthyThreshold    time.Duration `yaml:"load_balancer_healthy_threshold,omitempty"`
	PublishStartMessageInterval     time.Duration `yaml:"publish_start_message_interval,omitempty"`
	SuspendPruningIfNatsUnavailable bool          `yaml:"suspend_pruning_if_nats_unavailable,omitempty"`
	PruneStaleDropletsInterval      time.Duration `yaml:"prune_stale_droplets_interval,omitempty"`
	DropletStaleThreshold           time.Duration `yaml:"droplet_stale_threshold,omitempty"`
	PublishActiveAppsInterval       time.Duration `yaml:"publish_active_apps_interval,omitempty"`
	StartResponseDelayInterval      time.Duration `yaml:"start_response_delay_interval,omitempty"`
	EndpointTimeout                 time.Duration `yaml:"endpoint_timeout,omitempty"`
	EndpointDialTimeout             time.Duration `yaml:"-"`
	RouteServiceTimeout             time.Duration `yaml:"route_services_timeout,omitempty"`
	FrontendIdleTimeout             time.Duration `yaml:"frontend_idle_timeout,omitempty"`

	RouteLatencyMetricMuzzleDuration time.Duration `yaml:"route_latency_metric_muzzle_duration,omitempty"`

	DrainWait            time.Duration `yaml:"drain_wait,omitempty"`
	DrainTimeout         time.Duration `yaml:"drain_timeout,omitempty"`
	SecureCookies        bool          `yaml:"secure_cookies,omitempty"`
	HealthCheckUserAgent string        `yaml:"healthcheck_user_agent,omitempty"`

	OAuth                      OAuthConfig      `yaml:"oauth,omitempty"`
	RoutingApi                 RoutingApiConfig `yaml:"routing_api,omitempty"`
	RouteServiceSecret         string           `yaml:"route_services_secret,omitempty"`
	RouteServiceSecretPrev     string           `yaml:"route_services_secret_decrypt_only,omitempty"`
	RouteServiceRecommendHttps bool             `yaml:"route_services_recommend_https,omitempty"`
	// These fields are populated by the `Process` function.
	Ip                          string        `yaml:"-"`
	RouteServiceEnabled         bool          `yaml:"-"`
	NatsClientPingInterval      time.Duration `yaml:"nats_client_ping_interval,omitempty"`
	NatsClientMessageBufferSize int           `yaml:"-"`
	Backends                    BackendConfig `yaml:"backends,omitempty"`
	ExtraHeadersToLog           []string      `yaml:"extra_headers_to_log,omitempty"`

	TokenFetcherMaxRetries                    uint32        `yaml:"token_fetcher_max_retries,omitempty"`
	TokenFetcherRetryInterval                 time.Duration `yaml:"token_fetcher_retry_interval,omitempty"`
	TokenFetcherExpirationBufferTimeInSeconds int64         `yaml:"token_fetcher_expiration_buffer_time,omitempty"`

	PidFile     string `yaml:"pid_file,omitempty"`
	LoadBalance string `yaml:"balancing_algorithm,omitempty"`

	DisableKeepAlives   bool `yaml:"disable_keep_alives,omitempty"`
	MaxIdleConns        int  `yaml:"max_idle_conns,omitempty"`
	MaxIdleConnsPerHost int  `yaml:"max_idle_conns_per_host,omitempty"`
}

func DefaultConfig

func DefaultConfig() (*Config, error)

func InitConfigFromFile

func InitConfigFromFile(path string) (*Config, error)

func (*Config) Initialize

func (c *Config) Initialize(configYAML []byte) error

func (*Config) NatsServers

func (c *Config) NatsServers() []string

func (*Config) Process

func (c *Config) Process() error

func (*Config) RoutingApiEnabled

func (c *Config) RoutingApiEnabled() bool

type LoggingConfig

type LoggingConfig struct {
	Syslog                 string `yaml:"syslog"`
	SyslogAddr             string
	SyslogNetwork          string
	Level                  string `yaml:"level"`
	LoggregatorEnabled     bool   `yaml:"loggregator_enabled"`
	MetronAddress          string `yaml:"metron_address"`
	DisableLogForwardedFor bool   `yaml:"disable_log_forwarded_for"`
	DisableLogSourceIP     bool   `yaml:"disable_log_source_ip"`

	// This field is populated by the `Process` function.
	JobName string `yaml:"-"`
}

type NatsConfig

type NatsConfig struct {
	Host string `yaml:"host"`
	Port uint16 `yaml:"port"`
	User string `yaml:"user"`
	Pass string `yaml:"pass"`
}

type OAuthConfig

type OAuthConfig struct {
	TokenEndpoint     string `yaml:"token_endpoint"`
	Port              int    `yaml:"port"`
	SkipSSLValidation bool   `yaml:"skip_ssl_validation"`
	ClientName        string `yaml:"client_name"`
	ClientSecret      string `yaml:"client_secret"`
	CACerts           string `yaml:"ca_certs"`
}

type RoutingApiConfig

type RoutingApiConfig struct {
	Uri          string `yaml:"uri"`
	Port         int    `yaml:"port"`
	AuthDisabled bool   `yaml:"auth_disabled"`
}

type StatusConfig

type StatusConfig struct {
	Host string `yaml:"host"`
	Port uint16 `yaml:"port"`
	User string `yaml:"user"`
	Pass string `yaml:"pass"`
}

type TLSPem

type TLSPem struct {
	CertChain  string `yaml:"cert_chain"`
	PrivateKey string `yaml:"private_key"`
}

type Tracing

type Tracing struct {
	EnableZipkin bool `yaml:"enable_zipkin"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL