From d10c84d974cfe91393fd3e2393720fb0ec51ccd4 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Fri, 12 Apr 2024 20:47:55 -0600 Subject: [PATCH] don't check for duplicates when getting a proxy --- src/proxy/proxy.go | 4 ++-- src/proxy/threads.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/proxy/proxy.go b/src/proxy/proxy.go index 8f7ed3e..3c7f3fd 100644 --- a/src/proxy/proxy.go +++ b/src/proxy/proxy.go @@ -54,7 +54,7 @@ func (p *ForwardProxyCluster) cycleProxy(validProxies []string, currentProxy *in func (p *ForwardProxyCluster) getProxyFromAll() string { p.mu.RLock() defer p.mu.RUnlock() - validProxies := removeDuplicates(append(p.ourOnlineProxies, p.thirdpartyOnlineProxies...)) + validProxies := append(p.ourOnlineProxies, p.thirdpartyOnlineProxies...) return p.cycleProxy(validProxies, &p.currentProxyAll) } @@ -68,7 +68,7 @@ func (p *ForwardProxyCluster) getProxyFromOurs() string { func (p *ForwardProxyCluster) getProxyFromAllWithBroken() string { p.mu.RLock() defer p.mu.RUnlock() - validProxies := removeDuplicates(slices.Concat(p.ourOnlineProxies, p.thirdpartyBrokenProxies, p.thirdpartyOnlineProxies)) + validProxies := slices.Concat(p.ourOnlineProxies, p.thirdpartyBrokenProxies, p.thirdpartyOnlineProxies) return p.cycleProxy(validProxies, &p.currentProxyAllWithBroken) } diff --git a/src/proxy/threads.go b/src/proxy/threads.go index e3c6f5c..ce5fa07 100644 --- a/src/proxy/threads.go +++ b/src/proxy/threads.go @@ -72,10 +72,10 @@ func (p *ForwardProxyCluster) ValidateProxiesThread() { wg.Wait() p.mu.Lock() - p.ourOnlineProxies = newOurOnlineProxies - p.thirdpartyOnlineProxies = newThirdpartyOnlineProxies - p.thirdpartyBrokenProxies = newThirdpartyBrokenProxies - p.ipAddresses = newIpAddresses + p.ourOnlineProxies = removeDuplicates(newOurOnlineProxies) + p.thirdpartyOnlineProxies = removeDuplicates(newThirdpartyOnlineProxies) + p.thirdpartyBrokenProxies = removeDuplicates(newThirdpartyBrokenProxies) + p.ipAddresses = removeDuplicates(newIpAddresses) p.mu.Unlock() if !started {