From 7a9522526d1e0198b348d534eed669562812c37b Mon Sep 17 00:00:00 2001 From: typhoon Date: Mon, 12 Sep 2022 22:21:00 +1000 Subject: [PATCH] active proxies will bew update after success checking on blocked of list --- extensions/servers/gin/domains/proxy/proxy.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extensions/servers/gin/domains/proxy/proxy.go b/extensions/servers/gin/domains/proxy/proxy.go index 6a644cb..a71c7c1 100644 --- a/extensions/servers/gin/domains/proxy/proxy.go +++ b/extensions/servers/gin/domains/proxy/proxy.go @@ -148,6 +148,7 @@ func (c *Collection) RemoveProxyBan(proxy string) error { }) if err == nil && indexBanned > -1 { c.banned = append(c.banned[:indexBanned], c.banned[indexBanned+1:]...) + c.allowed = append(c.allowed, proxy) } return err @@ -360,7 +361,7 @@ func (c *Collection) init() { proxyList := strings.Split(proxyEnvList, "\n") c.list = proxyList - c.allowed, c.locked, c.banned = c.getLists(proxyList) + c.allowed, c.locked, c.banned = c.getLists() } func (c *Collection) Init() *Collection { @@ -420,12 +421,12 @@ func (c *Collection) getBanKey(value string) string { return fmt.Sprintf("%s:%s", "bans", c.GetFullKeyPath(value)) } -func (c *Collection) getLists(proxyList []string) ([]string, []string, []string) { - var allowed []string - var locked []string - var banned []string +func (c *Collection) getLists() ([]string, []string, []string) { + allowed := make([]string, 0) + locked := make([]string, 0) + banned := make([]string, 0) - for _, value := range proxyList { + for _, value := range c.list { if len(value) == 0 { continue }