settings

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUpdateStatisticsInterval       = "1m"
	DefaultTrafficChangeSendEventInterval = "5m"
	DefaultMaxUpstreamTrafficChange       = "50Mb"
	DefaultMaxDownstreamTrafficChange     = "50Mb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminAPIConfig

type AdminAPIConfig struct {
	PasswordHash  string `yaml:"password_hash"`
	StaticRoot    string `yaml:"static_root" valid:"path"`
	TokenLifetime int    `yaml:"token_lifetime" valid:"natural"`
}

type Config

type Config struct {
	InstanceID string           `yaml:"instance_id"`
	LogLevel   string           `yaml:"log_level"`
	SQLitePath string           `yaml:"sqlite_path" valid:"path,required"`
	Rapidoc    bool             `yaml:"rapidoc"`
	Wireguard  wireguard.Config `yaml:"wireguard"`
	HTTP       HttpConfig       `yaml:"http"`

	// optional configuration
	ExternalStats      *extstat.Config             `yaml:"external_stats,omitempty"`
	NetworkPolicy      *NetworkAccessPolicy        `yaml:"network,omitempty"`
	SSL                *xhttp.SSLConfig            `yaml:"ssl,omitempty"`
	Domain             *xhttp.DomainConfig         `yaml:"domain,omitempty"`
	AdminAPI           *AdminAPIConfig             `yaml:"admin_api,omitempty"`
	PublicAPI          *PublicAPIConfig            `yaml:"public_api,omitempty"`
	GRPC               *grpc.Config                `yaml:"grpc,omitempty"`
	Sentry             *sentry.Config              `yaml:"sentry,omitempty"`
	EventLog           *eventlog.StorageConfig     `yaml:"event_log,omitempty"`
	ManagementKeystore string                      `yaml:"management_keystore,omitempty" valid:"path"`
	DNSFilter          *xdns.Config                `yaml:"dns_filter"`
	PortRestrictions   *ipam.PortRestrictionConfig `yaml:"ports,omitempty"`
	PeerStatistics     *PeerStatisticConfig        `yaml:"peer_statistics,omitempty"`
	GeoDBPath          string                      `yaml:"geo_db_path,omitempty"`
	IPRose             *iprose.Config              `yaml:"iprose,omitempty"`
	// contains filtered or unexported fields
}

func LoadStatic

func LoadStatic(configDir string) (*Config, error)

func (*Config) CleanAdminPassword

func (s *Config) CleanAdminPassword()

func (*Config) ConfigDir

func (s *Config) ConfigDir() string

func (*Config) Flush

func (s *Config) Flush() error

func (*Config) GetNetworkAccessPolicy added in v0.2.5

func (s *Config) GetNetworkAccessPolicy() NetworkAccessPolicy

func (*Config) GetPublicAPIConfig

func (s *Config) GetPublicAPIConfig() *PublicAPIConfig

func (*Config) GetSentEventInterval added in v0.3.5

func (s *Config) GetSentEventInterval() human.Interval

func (*Config) GetUpdateStatisticsInterval added in v0.3.5

func (s *Config) GetUpdateStatisticsInterval() human.Interval

func (*Config) InitialSetupRequired

func (s *Config) InitialSetupRequired() bool

func (*Config) PublicURL

func (s *Config) PublicURL() string

PublicURL returns a URL of this node. Use SSL configuration if given, otherwise it returns http://wireguard_ip:http_listen_port

func (*Config) SetAdminPassword

func (s *Config) SetAdminPassword(plain string) error

func (*Config) SetPublicIP

func (s *Config) SetPublicIP(newIP xnet.IP) error

func (*Config) VerifyAdminPassword

func (s *Config) VerifyAdminPassword(given string) error

type HttpConfig

type HttpConfig struct {
	// ListenAddr for HTTP server, default: ":80"
	ListenAddr string `yaml:"listen_addr" valid:"listen_addr,required"`
	// CORS enables corresponding middleware for the local development
	CORS bool `yaml:"cors"`
	// Enable prometheus metrics on "/metrics" path
	Prometheus bool `yaml:"prometheus"`
}

type NetworkAccessPolicy added in v0.2.5

type NetworkAccessPolicy struct {
	Access    ipam.NetworkAccess      `yaml:"access"`
	RateLimit *ipam.RateLimiterConfig `yaml:"rate_limit,omitempty"`
}

type PeerStatisticConfig added in v0.3.5

type PeerStatisticConfig struct {
	// Interval to update tunnel (all peers) statistics
	// Min valid value = 1m
	UpdateStatisticsInterval human.Interval `yaml:"update_statistics_interval" valid:"interval"`
	// Min interval to sent updated peers with new traffic counters
	// Interval must be defined in duration format.
	// Valid time units: "ns", "us", "ms", "s", "m", "h".
	// https://pkg.go.dev/time#ParseDuration
	// or
	// be defined as integer in seconds
	// Note: it must be >= UpdateStatisticsInterval
	// = UpdateStatisticsInterval if < UpdateStatisticsInterval
	TrafficChangeSendEventInterval human.Interval `yaml:"traffic_change_send_event_interval" valid:"interval"`
	// Min pace to sent updated peers with new traffic counters
	// Interval must be defined in duration format.
	// Valid size units in human readable format "b", "kb", "mb", "gb"
	// https://pkg.go.dev/time#ParseDuration
	// or
	// be defined as integer in bytes
	// "" or 0 means it's disabled
	MaxUpstreamTrafficChange   human.Size `yaml:"max_upstream_traffic_change" valid:"size"`
	MaxDownstreamTrafficChange human.Size `yaml:"max_downstream_traffic_change" valid:"size"`
}

type PublicAPIConfig

type PublicAPIConfig struct {
	PingInterval int `yaml:"ping_interval" valid:"natural"`
	PeerTTL      int `yaml:"connection_timeout" valid:"natural"`
}

Jump to

Keyboard shortcuts

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