fix: 修复当订阅链接有多个 clash 配置时丢失节点的问题
update: 增加检测更新
modify: 修改数据库路径
modify: 修改短链生成逻辑
modify: 统一输出信息
This commit is contained in:
Nite07
2023-09-21 09:08:02 +08:00
committed by GitHub
parent f166c6a54a
commit 8d06ab3175
27 changed files with 588 additions and 349 deletions

View File

@ -11,12 +11,12 @@ import (
func ParseVless(proxy string) (model.Proxy, error) {
// 判断是否以 vless:// 开头
if !strings.HasPrefix(proxy, "vless://") {
return model.Proxy{}, fmt.Errorf("无效的 vless Url")
return model.Proxy{}, fmt.Errorf("invalid vless Url")
}
// 分割
parts := strings.SplitN(strings.TrimPrefix(proxy, "vless://"), "@", 2)
if len(parts) != 2 {
return model.Proxy{}, fmt.Errorf("无效的 vless Url")
return model.Proxy{}, fmt.Errorf("invalid vless Url")
}
// 分割
serverInfo := strings.SplitN(parts[1], "#", 2)
@ -27,7 +27,7 @@ func ParseVless(proxy string) (model.Proxy, error) {
return model.Proxy{}, err
}
if len(serverAndPort) != 2 {
return model.Proxy{}, fmt.Errorf("无效的 vless 服务器和端口")
return model.Proxy{}, fmt.Errorf("invalid vless")
}
// 处理端口
port, err := strconv.Atoi(strings.TrimSpace(serverAndPort[1]))