From f40e8a432fcd83820467044efda915847c43b6f0 Mon Sep 17 00:00:00 2001 From: aries15 <60699238+aries15@users.noreply.github.com> Date: Sun, 30 Oct 2022 20:04:38 +0800 Subject: [PATCH] Fix ipv6 net.CIDRMask --- header/ghostcp.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/header/ghostcp.go b/header/ghostcp.go index f9dca81..c2f5b4f 100644 --- a/header/ghostcp.go +++ b/header/ghostcp.go @@ -165,7 +165,7 @@ func IPLookup(addr string) (IPConfig, bool) { } } else { for i := 64; i >= 16; i -= 16 { - mask := net.CIDRMask(i, 32) + mask := net.CIDRMask(i, 128) addr := fmt.Sprintf("%s/%d", ip.Mask(mask).String(), i) config, ok = IPMap[addr] if ok { @@ -198,7 +198,7 @@ func IPBlockLookup(addr string) (IPConfig, bool) { } } else { for i := 64; i >= 16; i -= 16 { - mask := net.CIDRMask(i, 32) + mask := net.CIDRMask(i, 128) addr := fmt.Sprintf("%s/%d", ip.Mask(mask).String(), i) config, ok = IPMap[addr] if ok {