config

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomDurationAround added in v1.7.0

func RandomDurationAround(duration time.Duration, scatteringPercentage float64) time.Duration

RandomDurationAround returns a duration (1.0 - percent) * duration < n < (1.0 + percent) * duration

Types

type Config

type Config struct {
	Interface             string        `envconfig:"INTERFACE"`
	Hostname              string        `envconfig:"HOSTNAME"`
	User                  string        `envconfig:"USER"`
	Password              string        `envconfig:"PASSWORD"`
	Port                  int           `envconfig:"PORT" default:"1313"`
	KeepAliveInterval     time.Duration `envconfig:"KEEPALIVE_INTERVAL" default:"3s"`
	KeepAliveRetry        int           `envconfig:"KEEPALIVE_RETRY" default:"5"`
	HealthcheckInterval   time.Duration `envconfig:"HEALTH_CHECK_INTERVAL" default:"5s"`
	HealthcheckTimeout    time.Duration `envconfig:"HEALTH_CHECK_TIMEOUT" default:"5s"`
	ARPGratuitousInterval time.Duration `envconfig:"ARP_GRATUITOUS_INTERVAL" default:"1s"`
	// Number of gratuitous ARP (GARP) packets sent when the state becomes 'ACTIVATED'
	ARPGratuitousCount      int `envconfig:"ARP_GRATUITOUS_COUNT" default:"3"`
	FailCountBeforeFailover int `envconfig:"FAIL_COUNT_BEFORE_FAILOVER" default:"3"`
}

func Build

func Build() (Config, error)

func (Config) LeaseTime

func (c Config) LeaseTime() time.Duration

LeaseTime is 5 * the global keepalive interval

Jump to

Keyboard shortcuts

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