config

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DNSProviderConfigured added in v0.6.0

func DNSProviderConfigured() bool

func GetBool

func GetBool(key string, defaultValue bool) bool

func GetString

func GetString(key, defaultValue string) string

func GetUint64 added in v0.15.0

func GetUint64(key string, defaultValue uint64) uint64

func KeepAliveInterval

func KeepAliveInterval() time.Duration

func MagicDNSSuffix added in v0.2.0

func MagicDNSSuffix() string

Types

type Auth added in v0.3.0

type Auth struct {
	Provider          AuthProvider      `yaml:"provider,omitempty" envPrefix:"PROVIDER_"`
	SystemAdminPolicy SystemAdminPolicy `yaml:"system_admins"`
}

type AuthProvider

type AuthProvider struct {
	Issuer       string   `yaml:"issuer" env:"ISSUER"`
	ClientID     string   `yaml:"client_id" env:"CLIENT_ID"`
	ClientSecret string   `yaml:"client_secret" env:"CLIENT_SECRET"`
	Scopes       []string `yaml:"additional_scopes"  env:"SCOPES"`
}

type Config

type Config struct {
	ListenAddr        string   `yaml:"listen_addr,omitempty" env:"LISTEN_ADDR"`
	StunListenAddr    string   `yaml:"stun_listen_addr,omitempty" env:"STUN_LISTEN_ADDR"`
	MetricsListenAddr string   `yaml:"metrics_listen_addr,omitempty" env:"METRICS_LISTEN_ADDR"`
	PublicAddr        string   `yaml:"public_addr,omitempty" env:"PUBLIC_ADDR"`
	StunPublicAddr    string   `yaml:"stun_public_addr,omitempty" env:"STUN_PUBLIC_ADDR"`
	Tls               Tls      `yaml:"tls,omitempty" envPrefix:"TLS_"`
	PollNet           PollNet  `yaml:"poll_net,omitempty" envPrefix:"POLL_NET_"`
	Keys              Keys     `yaml:"keys,omitempty" envPrefix:"KEYS_"`
	Database          Database `yaml:"database,omitempty" envPrefix:"DB_"`
	Auth              Auth     `yaml:"auth,omitempty" envPrefix:"AUTH_"`
	DNS               DNS      `yaml:"dns,omitempty"`
	DERP              DERP     `yaml:"derp,omitempty" envPrefix:"DERP_"`
	Logging           Logging  `yaml:"logging,omitempty" envPrefix:"LOGGING_"`

	PublicUrl *url.URL `yaml:"-"`
	// contains filtered or unexported fields
}

func LoadConfig

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

func (*Config) CreateUrl

func (c *Config) CreateUrl(format string, a ...interface{}) string

func (*Config) DefaultDERPMap added in v0.15.0

func (c *Config) DefaultDERPMap() *tailcfg.DERPMap

func (*Config) ReadServerKeys

func (c *Config) ReadServerKeys(defaultKeys *domain.ControlKeys) (*ServerKeys, error)

func (*Config) Validate added in v0.15.0

func (c *Config) Validate() (*Config, error)

type DERP added in v0.15.0

type DERP struct {
	Server  DERPServer `yaml:"server,omitempty"`
	Sources []string   `yaml:"sources,omitempty"`
}

type DERPServer added in v0.15.0

type DERPServer struct {
	Disabled   bool   `yaml:"disabled,omitempty"`
	RegionID   int    `yaml:"region_id,omitempty"`
	RegionCode string `yaml:"region_code,omitempty"`
	RegionName string `yaml:"region_name,omitempty"`
}

type DNS added in v0.2.0

type DNS struct {
	MagicDNSSuffix string      `yaml:"magic_dns_suffix"`
	Provider       DNSProvider `yaml:"provider,omitempty"`
}

type DNSProvider added in v0.3.0

type DNSProvider struct {
	Name          string            `yaml:"name"`
	Zone          string            `yaml:"zone"`
	Configuration map[string]string `yaml:"config"`
}

type Database

type Database struct {
	Type            string        `yaml:"type,omitempty" env:"TYPE"`
	Url             string        `yaml:"url,omitempty" env:"URL"`
	MaxOpenConns    int           `yaml:"max_open_conns,omitempty" env:"MAX_OPEN_CONNS"`
	MaxIdleConns    int           `yaml:"max_idle_conns,omitempty" env:"MAX_IDLE_CONNS"`
	ConnMaxLifetime time.Duration `yaml:"conn_max_life_time,omitempty" env:"CONN_MAX_LIFE_TIME"`
	ConnMaxIdleTime time.Duration `yaml:"conn_max_idle_time,omitempty" env:"CONN_MAX_IDLE_TIME"`
}

type Keys

type Keys struct {
	ControlKey       string `yaml:"control_key,omitempty" env:"CONTROL_KEY"`
	LegacyControlKey string `yaml:"legacy_control_key,omitempty" env:"LEGACY_CONTROL_KEY"`
	SystemAdminKey   string `yaml:"system_admin_key,omitempty" env:"SYSTEM_ADMIN_KEY"`
}

type Logging

type Logging struct {
	Level  string `yaml:"level,omitempty" env:"LEVEL"`
	Format string `yaml:"format,omitempty" env:"FORMAT"`
	File   string `yaml:"file,omitempty" env:"FILE"`
}

type PollNet

type PollNet struct {
	KeepAliveInterval time.Duration `yaml:"keep_alive_interval" env:"KEEP_ALIVE_INTERVAL"`
}

type ServerKeys

type ServerKeys struct {
	SystemAdminKey   *key.ServerPrivate
	ControlKey       tkey.MachinePrivate
	LegacyControlKey tkey.MachinePrivate
}

type SystemAdminPolicy

type SystemAdminPolicy struct {
	Subs    []string `yaml:"subs,omitempty"`
	Emails  []string `yaml:"emails,omitempty"`
	Filters []string `yaml:"filters,omitempty"`
}

type Tls

type Tls struct {
	Disable     bool   `yaml:"disable" env:"DISABLE"`
	ForceHttps  bool   `yaml:"force_https" env:"FORCE_HTTPS"`
	CertFile    string `yaml:"cert_file,omitempty" env:"CERT_FILE"`
	KeyFile     string `yaml:"key_file,omitempty" env:"KEY_FILE"`
	AcmeEnabled bool   `yaml:"acme,omitempty" env:"ACME_ENABLED"`
	AcmeEmail   string `yaml:"acme_email,omitempty" env:"ACME_EMAIL"`
	AcmeCA      string `yaml:"acme_ca,omitempty" env:"ACME_CA"`
}

Jump to

Keyboard shortcuts

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