config

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateProxy

func ValidateProxy(value string) error

ValidateProxy 校验账户或全局代理 URL

Types

type Config

type Config struct {
	AuthStates             string        `json:"auth_states"`
	ListenAddr             string        `json:"listen_addr"`
	ProxyAPIKey            string        `json:"proxy_api_key"`
	Proxy                  string        `json:"proxy"`
	InitTimeout            time.Duration `json:"-"`
	RequestTimeout         time.Duration `json:"-"`
	WarmWorkerLimit        int           `json:"warm_worker_limit"`
	MaxActiveWorkers       int           `json:"max_active_workers"`
	WarmStartupConcurrency int           `json:"warm_startup_concurrency"`
	PerAccountConcurrency  int           `json:"per_account_concurrency"`
	RoutingStrategy        string        `json:"routing_strategy"`
	TemporaryChat          bool          `json:"temporary_chat"`
}

Config 保存服务的全局配置

func Default

func Default() Config

Default 返回可直接启动的默认配置

func Load

func Load(path string) (Config, error)

Load 从指定 env 文件和进程环境加载配置

func (Config) MarshalJSON

func (c Config) MarshalJSON() ([]byte, error)

MarshalJSON 将时长输出为 env 使用的文本格式

func (Config) Save

func (c Config) Save(path string) error

Save 将配置原子写入指定 env 文件

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON 从管理接口使用的文本时长解析配置

func (Config) Validate

func (c Config) Validate() error

Validate 校验配置值是否能用于服务启动

Jump to

Keyboard shortcuts

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