Skip to content

Commit

Permalink
♻️ Refactor: Use Global vars instead of local vars for isLocalHost (#…
Browse files Browse the repository at this point in the history
…2595)

♻️ Refactor: Use Global vars instead of local vars for isLocalHost
  • Loading branch information
LimJiAn authored Aug 23, 2023
1 parent 4085014 commit 8ec7cec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -1887,9 +1887,10 @@ func (c *Ctx) IsProxyTrusted() bool {
return false
}

var localHosts = [...]string{"127.0.0.1", "0.0.0.0", "::1"}

// IsLocalHost will return true if address is a localhost address.
func (*Ctx) isLocalHost(address string) bool {
localHosts := []string{"127.0.0.1", "0.0.0.0", "::1"}
for _, h := range localHosts {
if strings.Contains(address, h) {
return true
Expand Down

0 comments on commit 8ec7cec

Please sign in to comment.