add crawl time show

This commit is contained in:
zu1k
2020-08-21 13:25:38 +08:00
parent 45275bc2d3
commit fe6c8e603b
4 changed files with 8 additions and 0 deletions

View File

@@ -31,6 +31,7 @@ func setupRouter() {
"vmess_proxies_count": cache.VmessProxiesCount,
"trojan_proxies_count": cache.TrojanProxiesCount,
"useful_proxies_count": cache.UsefullProxiesCount,
"last_crawl_time": cache.LastCrawlTime,
})
})

View File

@@ -113,6 +113,7 @@
<p>vmess节点数量{{ .vmess_proxies_count }}</p>
<p>trojan节点数量{{ .trojan_proxies_count }}</p>
<p>可用节点数量:{{ .useful_proxies_count }}</p>
<p>最后更新时间:{{ .last_crawl_time }}</p>
<br>
<h5><a href="/clash">Clash</a></h5>
<p>Clash配置文件https://{{ .domain }}/clash/config <a

View File

@@ -6,6 +6,7 @@ import (
"log"
"os"
"sync"
"time"
"github.com/zu1k/proxypool/config"
"github.com/zu1k/proxypool/internal/cache"
@@ -15,6 +16,8 @@ import (
"gopkg.in/yaml.v2"
)
var location, _ = time.LoadLocation("PRC")
func CrawlGo() {
if config.NeedFetch {
FetchNewConfigFileThenInit()
@@ -46,6 +49,7 @@ func CrawlGo() {
cache.SSRProxiesCount = proxies.TypeLen("ssr")
cache.VmessProxiesCount = proxies.TypeLen("vmess")
cache.TrojanProxiesCount = proxies.TypeLen("trojan")
cache.LastCrawlTime = time.Now().In(location).Format("2006-01-02 15:04:05")
// 可用性检测
proxies = proxy.CleanBadProxies(proxies)

View File

@@ -8,4 +8,6 @@ var (
TrojanProxiesCount = 0
UsefullProxiesCount = 0
LastCrawlTime = "程序刚升级完成,正在爬取中..."
)