config

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSourceURL    = "http://www.vpngate.net/api/iphone/"
	DefaultSpeedTestURL = "" /* 158-byte string literal not displayed */
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SourceURL              string   `json:"sourceUrl"`
	RefreshInterval        string   `json:"refreshInterval"`
	FilterExpression       string   `json:"filterExpression"`
	SelectionMode          string   `json:"selectionMode"`
	FollowRankingOnRefresh bool     `json:"followRankingOnRefresh"`
	FallbackToDirect       bool     `json:"fallbackToDirect"`
	SOCKS5                 SOCKS5   `json:"socks5"`
	Monitor                Monitor  `json:"monitor"`
	Web                    Web      `json:"web"`
	DatabasePath           string   `json:"databasePath"`
	DNSServers             []string `json:"dnsServers"`
	SpeedTestURL           string   `json:"speedTestUrl"`
	SpeedTestTimeout       string   `json:"speedTestTimeout"`
	ProtocolPriority       []string `json:"protocolPriority"`
	ConnectTimeout         string   `json:"connectTimeout"`
	VPNGateUsername        string   `json:"vpnGateUsername"`
	VPNGatePassword        string   `json:"vpnGatePassword"`
	VPNGatePreSharedKey    string   `json:"vpnGatePreSharedKey"`
}

func Default

func Default() Config

func (Config) ConnectTimeoutDuration

func (c Config) ConnectTimeoutDuration() (time.Duration, error)

func (Config) MonitorInterval

func (c Config) MonitorInterval() (time.Duration, error)

func (Config) MonitorTimeout

func (c Config) MonitorTimeout() (time.Duration, error)

func (Config) RefreshDuration

func (c Config) RefreshDuration() (time.Duration, error)

func (Config) SpeedTestTimeoutDuration

func (c Config) SpeedTestTimeoutDuration() (time.Duration, error)

func (Config) Validate

func (c Config) Validate() error

type Monitor

type Monitor struct {
	URL      string `json:"url"`
	Interval string `json:"interval"`
	Timeout  string `json:"timeout"`
}

type SOCKS5

type SOCKS5 struct {
	ListenAddress    string `json:"listenAddress"`
	Username         string `json:"username"`
	Password         string `json:"password"`
	IdleTimeout      string `json:"idleTimeout"`
	HalfCloseTimeout string `json:"halfCloseTimeout"`
}

func (SOCKS5) HalfCloseTimeoutDuration added in v0.0.5

func (s SOCKS5) HalfCloseTimeoutDuration() (time.Duration, error)

func (SOCKS5) IdleTimeoutDuration added in v0.0.5

func (s SOCKS5) IdleTimeoutDuration() (time.Duration, error)

type Store

type Store struct {
	// contains filtered or unexported fields
}

func Load

func Load(path string) (*Store, error)

func LoadWithLogger added in v0.0.2

func LoadWithLogger(path string, logger *log.Logger) (*Store, error)

LoadWithLogger behaves like Load and reports the generated first-run password exactly once, when a configuration file is created.

func (*Store) Get

func (s *Store) Get() Config

func (*Store) Save

func (s *Store) Save(value Config) error

type Web

type Web struct {
	ListenAddress string `json:"listenAddress"`
	Username      string `json:"username"`
	PasswordHash  string `json:"passwordHash"`
	SessionSecret string `json:"sessionSecret"`
}

Jump to

Keyboard shortcuts

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