config

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMaxConnection             = 512
	DefaultMaxConnWaitTimeout        = time.Second * 30
	DefaultMaxConnDuration           = time.Second * 10
	DefaultMaxIdleConnDuration       = time.Second * 10
	DefaultMaxIdemponentCallAttempts = 5

	DefaultHealtCheckerTime = time.Second * 30

	Http1 = "http1.1"
	Http2 = "http2"

	DefaultMaxIdleWorkerDuration = 10 * time.Second
)

Variables

View Source
var ValidCustomHeaders = []string{"$remote_addr", "$time", "$uuid", "$incremental"}
View Source
var ValidTypes = []string{"round-robin", "w-round-robin", "ip-hash", "random", "least-connection"}

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Url                       string        `yaml:"url"`
	HealthCheckPath           string        `yaml:"health_check_path"`
	Weight                    uint          `yaml:"weight,omitempty"`
	MaxConnection             int           `yaml:"max_conn"`
	MaxConnWaitTimeout        time.Duration `yaml:"max_conn_timeout"`
	MaxConnDuration           time.Duration `yaml:"max_conn_duration"`
	MaxIdleConnDuration       time.Duration `yaml:"max_idle_conn_duration"`
	MaxIdemponentCallAttempts int           `yaml:"max_idemponent_call_attempts"`
}

func (*Backend) GetHealthCheckURL

func (b *Backend) GetHealthCheckURL() string

type Config

type Config struct {
	CustomHeaders     map[string]string `yaml:"custom_headers"`
	HealthCheckerFunc types.IsHostAlive
	HashFunc          types.HashFunc
	Monitoring        Monitoring    `yaml:"monitoring"`
	Type              string        `yaml:"type"`
	Host              string        `yaml:"host"`
	Port              string        `yaml:"port"`
	Backends          []Backend     `yaml:"backends"`
	Server            Server        `yaml:"server"`
	HealthCheckerTime time.Duration `yaml:"health_checker_time"`
}

func ParseConfigFile

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

func (*Config) GetAddr

func (c *Config) GetAddr() string

func (*Config) GetMonitoringAddr

func (c *Config) GetMonitoringAddr() string

func (*Config) PrepareConfig

func (c *Config) PrepareConfig() error

type Monitoring

type Monitoring struct {
	Host string `yaml:"host"`
	Port string `yaml:"port"`
}

type Server added in v0.3.0

type Server struct {
	HttpVersion                   string        `yaml:"http_version"`
	CertFile                      string        `yaml:"cert_file"`
	KeyFile                       string        `yaml:"key_file"`
	MaxIdleWorkerDuration         time.Duration `yaml:"max_idle_worker_duration"`
	TCPKeepalivePeriod            time.Duration `yaml:"tcp_keepalive_period"`
	Concurrency                   int           `yaml:"concurrency"`
	ReadTimeout                   time.Duration `yaml:"read_timeout"`
	WriteTimeout                  time.Duration `yaml:"write_timeout"`
	IdleTimeout                   time.Duration `yaml:"idle_timeout"`
	DisableKeepalive              bool          `yaml:"disable_keepalive"`
	DisableHeaderNamesNormalizing bool          `yaml:"disable_header_names_normalizing"`
}

Jump to

Keyboard shortcuts

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