diff --git a/api/router.go b/api/router.go index 69eb77c..898d132 100644 --- a/api/router.go +++ b/api/router.go @@ -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() diff --git a/app/task.go b/app/task.go index 01376c3..6a7b980 100644 --- a/app/task.go +++ b/app/task.go @@ -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() {