Help us shape the future of Go! Take the 2026 Go Developer Survey

config

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	APIAddress:          "http://127.0.0.1:9090",
	Secret:              "",
	TestURL:             "http://www.gstatic.com/generate_204",
	Timeout:             5000,
	ProxyAddress:        "http://127.0.0.1:7890",
	Language:            "auto",
	AutoRefreshInterval: 5,
}

DefaultConfig 默认配置

View Source
var ErrConfigNotFound = errors.New("配置文件不存在")

ErrConfigNotFound 配置文件不存在

Functions

func GetConfigDir

func GetConfigDir() (string, error)

GetConfigDir 获取配置目录

func GetMihomoConfigPath

func GetMihomoConfigPath() (string, error)

GetMihomoConfigPath 获取 mihomo 配置文件的默认路径

func GetMihomoConfigPathFromProcess

func GetMihomoConfigPathFromProcess() (string, error)

func Save

func Save(cfg *Config) error

Save 保存配置文件

Types

type Config

type Config struct {
	APIAddress          string `mapstructure:"api_address"`
	Secret              string `mapstructure:"secret"`
	TestURL             string `mapstructure:"test_url"`
	Timeout             int    `mapstructure:"timeout"`
	ProxyAddress        string `mapstructure:"proxy_address"`
	Language            string `mapstructure:"language"`
	AutoRefreshInterval int    `mapstructure:"auto_refresh_interval"`
}

Config 配置结构

func Load

func Load() (*Config, error)

Load 加载配置文件

Jump to

Keyboard shortcuts

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