Documentation
¶
Overview ¶
Package route 管理自动选线路由缓存(~/.javdb-cli/route.json)的原子读写。
schema 只保存 {"host":"https://..."},不保存 proxy、token、时间戳、测速历史或 fallback 状态。缺失文件是"无缓存";损坏、未知字段、空 host 或非法 URL 都显式报错,不伪装为 miss。
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptyHost = errors.New("route cache host is empty")
ErrEmptyHost 表示缓存 host 为空。
Functions ¶
func Save ¶
Save 原子写入 route cache:同目录私有临时文件、完整写入、Sync、rename 替换,目标 0600。 任一步失败都清理临时文件并显式返回错误,不留下半成品。
func ValidateHost ¶
ValidateHost 校验 host 为不含 query/fragment 的绝对 http/https URL。
Types ¶
Click to show internal directories.
Click to hide internal directories.