Skip to content

Commit

Permalink
Merge pull request #38 from vortex14/proxy-server
Browse files Browse the repository at this point in the history
active proxies will bew update after success checking on blocked of list
  • Loading branch information
vortex14 authored Sep 12, 2022
2 parents dddf1be + 7a95225 commit 7062936
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions extensions/servers/gin/domains/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 7062936

Please sign in to comment.