From 8ec7cec43522bc7fe2a035d42458d656e58b667f Mon Sep 17 00:00:00 2001 From: Jian Lim <85569173+LimJiAn@users.noreply.github.com> Date: Wed, 23 Aug 2023 19:19:22 +0900 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Refactor:=20Use=20Global?= =?UTF-8?q?=20vars=20instead=20of=20local=20vars=20for=20isLocalHost=20=20?= =?UTF-8?q?(#2595)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ♻️ Refactor: Use Global vars instead of local vars for isLocalHost --- ctx.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ctx.go b/ctx.go index 4f0e9481..ddb1e61d 100644 --- a/ctx.go +++ b/ctx.go @@ -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