mirror of
https://github.com/bestnite/sub2clash.git
synced 2025-07-04 11:52:34 +08:00
feat: 增加重复节点检测
feat: 增加节点名称字符串替换 feat: 增加节点删除 feat: 增加短链密码设定 modify: 修改模板解析逻辑
This commit is contained in:
14
utils/get.go
14
utils/get.go
@ -12,7 +12,19 @@ func Get(url string) (resp *http.Response, err error) {
|
||||
haveTried := 0
|
||||
retryDelay := time.Second // 延迟1秒再重试
|
||||
for haveTried < retryTimes {
|
||||
get, err := http.Get(url)
|
||||
client := &http.Client{}
|
||||
client.Timeout = time.Second * 10
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
if err != nil {
|
||||
haveTried++
|
||||
time.Sleep(retryDelay)
|
||||
continue
|
||||
}
|
||||
req.Header.Set(
|
||||
"User-Agent",
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
||||
)
|
||||
get, err := client.Do(req)
|
||||
if err != nil {
|
||||
haveTried++
|
||||
time.Sleep(retryDelay)
|
||||
|
@ -31,7 +31,6 @@ func AddProxy(
|
||||
sub *model.Subscription, autotest bool,
|
||||
lazy bool, clashType model.ClashType, proxies ...model.Proxy,
|
||||
) {
|
||||
newCountryGroupNames := make([]string, 0)
|
||||
proxyTypes := model.GetSupportProxyTypes(clashType)
|
||||
// 添加节点
|
||||
for _, proxy := range proxies {
|
||||
@ -79,7 +78,6 @@ func AddProxy(
|
||||
}
|
||||
}
|
||||
sub.ProxyGroups = append(sub.ProxyGroups, newGroup)
|
||||
newCountryGroupNames = append(newCountryGroupNames, countryName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user