Documentation
¶
Overview ¶
Package settings 管理 config.toml 的 schema 与优先级解析。
Index ¶
Constants ¶
View Source
const ( HostAuto = "auto" HostMirror = "mirror" HostMain = "main" )
Host names accepted by --host / config.
Variables ¶
View Source
var HostURLs = map[string]string{ HostMirror: "https://jdforrepam.com", HostMain: "https://javdb.com", }
HostURLs maps logical host names to base URLs.
Functions ¶
func NormalizeHost ¶
NormalizeHost 校验并规范逻辑 host 或绝对 HTTP(S) URL。绝对 URL 必须不含 query 或 fragment,否则 transport 以字符串拼接追加 API path 时会把 endpoint 拼进 query 或根本不 发给服务器。
func ResolveProxy ¶
ResolveProxy 按 flag > env > file 的优先级解析代理,供无需 JavDB host 的独立流程复用。
func ValidateHost ¶
ValidateHost returns error if host is not a known name or absolute URL.
Types ¶
type Runtime ¶
type Runtime struct {
Host string // auto | mirror | main | URL
BaseURL string
Proxy string
AutoRelogin bool
Lang string
DeviceUUID string
}
Runtime is the resolved config after flag > env > file > default.
type Settings ¶
type Settings struct {
Host string `toml:"host"`
HTTPSProxy string `toml:"https_proxy,omitempty"`
AutoRelogin bool `toml:"auto_relogin"`
Lang string `toml:"lang,omitempty"`
DeviceUUID string `toml:"device_uuid,omitempty"` // optional override; else file/device_uuid
}
Settings is the on-disk config.toml schema.
Click to show internal directories.
Click to hide internal directories.