fix send on close channel

This commit is contained in:
zu1k
2020-08-12 19:57:57 +08:00
parent 21f55ac81d
commit 8f510c21fe
7 changed files with 7 additions and 12 deletions

View File

@@ -34,6 +34,7 @@ func CrawlGo() {
wg := &sync.WaitGroup{}
var pc = make(chan proxy.Proxy)
for _, g := range Getters {
wg.Add(1)
go g.Get2Chan(pc, wg)
}
proxies := cache.GetProxies()

View File

@@ -40,12 +40,11 @@ func (s *Subscribe) Get() []proxy.Proxy {
}
func (s *Subscribe) Get2Chan(pc chan proxy.Proxy, wg *sync.WaitGroup) {
wg.Add(1)
defer wg.Done()
nodes := s.Get()
for _, node := range nodes {
pc <- node
}
wg.Done()
}
func NewSubscribe(options tool.Options) Getter {

View File

@@ -61,10 +61,9 @@ func (g *TGChannelGetter) Get() []proxy.Proxy {
}
func (g *TGChannelGetter) Get2Chan(pc chan proxy.Proxy, wg *sync.WaitGroup) {
wg.Add(1)
defer wg.Done()
nodes := g.Get()
for _, node := range nodes {
pc <- node
}
wg.Done()
}

View File

@@ -61,10 +61,9 @@ func (w *WebFanqiangdang) Get() []proxy.Proxy {
}
func (w *WebFanqiangdang) Get2Chan(pc chan proxy.Proxy, wg *sync.WaitGroup) {
wg.Add(1)
defer wg.Done()
nodes := w.Get()
for _, node := range nodes {
pc <- node
}
wg.Done()
}

View File

@@ -34,12 +34,11 @@ func (w *WebFreessrXyz) Get() []proxy.Proxy {
}
func (w *WebFreessrXyz) Get2Chan(pc chan proxy.Proxy, wg *sync.WaitGroup) {
wg.Add(1)
defer wg.Done()
nodes := w.Get()
for _, node := range nodes {
pc <- node
}
wg.Done()
}
func freessrxyzFetch(link string) []proxy.Proxy {

View File

@@ -32,12 +32,11 @@ func (w *WebFuzz) Get() []proxy.Proxy {
}
func (w *WebFuzz) Get2Chan(pc chan proxy.Proxy, wg *sync.WaitGroup) {
wg.Add(1)
defer wg.Done()
nodes := w.Get()
for _, node := range nodes {
pc <- node
}
wg.Done()
}
func NewWebFuzzGetter(options tool.Options) Getter {

View File

@@ -67,12 +67,11 @@ func (w *WebLucnOrg) Get() []proxy.Proxy {
}
func (w *WebLucnOrg) Get2Chan(pc chan proxy.Proxy, wg *sync.WaitGroup) {
wg.Add(1)
defer wg.Done()
nodes := w.Get()
for _, node := range nodes {
pc <- node
}
wg.Done()
}
func decryptAesForLucn(code string, c string) []byte {