♻️ Refactor: Use Global vars instead of local vars for isLocalHost (#2595)

♻️ Refactor: Use Global vars instead of local vars for isLocalHost
pull/2597/head
Jian Lim 2023-08-23 19:19:22 +09:00 committed by GitHub
parent 408501434a
commit 8ec7cec435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

3
ctx.go
View File

@ -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