surge check
This commit is contained in:
@@ -19,9 +19,9 @@ func setupRouter() {
|
||||
router.StaticFile("/clash/config", "assets/clash-config.yaml")
|
||||
router.StaticFile("/surge/config", "assets/surge.conf")
|
||||
router.GET("/clash/proxies", func(c *gin.Context) {
|
||||
proxyTypes := c.DefaultQuery("type", "all")
|
||||
proxyTypes := c.DefaultQuery("type", "")
|
||||
text := ""
|
||||
if proxyTypes == "all" {
|
||||
if proxyTypes == "all" || proxyTypes == "" {
|
||||
text = cache.GetString("clashproxies")
|
||||
if text == "" {
|
||||
proxies := cache.GetProxies()
|
||||
|
||||
@@ -68,13 +68,14 @@ func CrawlGo() {
|
||||
for i := 0; i < num; i++ {
|
||||
proxies[i].SetName(strconv.Itoa(rand.Int()))
|
||||
}
|
||||
|
||||
log.Println("CrawlGo node count:", num)
|
||||
cache.SetProxies(proxies)
|
||||
cache.SetString("surgeproxies", provider.Surge{Proxies: proxies}.Provide())
|
||||
|
||||
proxies = checker.CleanProxies(provider.Clash{Proxies: proxies}.CleanProxies())
|
||||
log.Println("CrawlGo clash useable node count:", len(proxies))
|
||||
cache.SetString("clashproxies", provider.Clash{Proxies: proxies}.Provide())
|
||||
cache.SetString("surgeproxies", provider.Surge{Proxies: proxies}.Provide())
|
||||
}
|
||||
|
||||
func FetchNewConfigFileThenInit() {
|
||||
|
||||
Reference in New Issue
Block a user