From c87b5872e2fef1a1a20a01389607fcb467f1e914 Mon Sep 17 00:00:00 2001 From: zu1k Date: Wed, 12 Aug 2020 17:58:51 +0800 Subject: [PATCH] show count --- app/task.go | 1 + proxy/base.go | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/task.go b/app/task.go index eac30fb..bc246ab 100644 --- a/app/task.go +++ b/app/task.go @@ -54,6 +54,7 @@ func Crawl() { for i := 0; i < num; i++ { proxies[i].SetName(strconv.Itoa(rand.Int())) } + log.Println("Crawl node count:", num) cache.SetProxies(proxies) cache.SetString("clashproxies", provider.Clash{Proxies: proxies}.Provide()) } diff --git a/proxy/base.go b/proxy/base.go index 4629327..21715df 100644 --- a/proxy/base.go +++ b/proxy/base.go @@ -19,9 +19,11 @@ func Deduplication(src []Proxy) []Proxy { result := make([]Proxy, 0, len(src)) temp := map[string]struct{}{} for _, item := range src { - if _, ok := temp[item.Identifier()]; !ok { - temp[item.Identifier()] = struct{}{} - result = append(result, item) + if item != nil { + if _, ok := temp[item.Identifier()]; !ok { + temp[item.Identifier()] = struct{}{} + result = append(result, item) + } } } return result