Skip to content

Commit

Permalink
add proxies count show
Browse files Browse the repository at this point in the history
  • Loading branch information
zu1k committed Aug 20, 2020
1 parent 07a91fd commit 17c051c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ func setupRouter() {

router.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.html", gin.H{
"domain": domain,
"domain": domain,
"all_proxies_count": cache.AllProxiesCount,
"useful_proxies_count": cache.UsefullProxiesCount,
})
})

Expand Down
2 changes: 2 additions & 0 deletions assets/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
<h1><strong>免费节点</strong></h1>
<div class='article'>
<p>自动抓取tg频道、订阅地址、公开互联网上的ss、ssr、vmess节点信息,聚合去重后提供节点列表,每15分钟更新</p>
<p>汇总节点数量:{{ .all_proxies_count }}</p>
<p>可用节点数量:{{ .useful_proxies_count }}</p>
<br>
<h5><a href="/clash">Clash</a></h5>
<p>Clash配置文件:<a href="https://{{ .domain }}/clash/config">https://{{ .domain }}/clash/config</a> <a
Expand Down
2 changes: 2 additions & 0 deletions internal/app/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ func CrawlGo() {
proxies = provider.Clash{Proxies: proxies}.CleanProxies()
proxies.NameAddCounrty().Sort().NameAddIndex()
cache.SetProxies("allproxies", proxies)
cache.AllProxiesCount = proxies.Len()

// 可用性检测
proxies = proxy.CleanBadProxies(proxies)
log.Println("CrawlGo clash useable node count:", len(proxies))
proxies.NameAddCounrty().Sort().NameAddIndex()
cache.SetProxies("proxies", proxies)
cache.UsefullProxiesCount = proxies.Len()

cache.SetString("clashproxies", provider.Clash{Proxies: proxies}.Provide())
cache.SetString("surgeproxies", provider.Surge{Proxies: proxies}.Provide())
Expand Down
6 changes: 6 additions & 0 deletions internal/cache/vars.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package cache

var (
AllProxiesCount = 0
UsefullProxiesCount = 0
)

0 comments on commit 17c051c

Please sign in to comment.