surge check

This commit is contained in:
zu1k
2020-08-15 16:42:07 +08:00
parent 960b469d9b
commit 222800134f
2 changed files with 4 additions and 3 deletions

View File

@@ -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()

View File

@@ -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() {