From 2650a8c31fddab1f3663f43c0f88efa22aece00d Mon Sep 17 00:00:00 2001 From: minoplhy Date: Thu, 11 Apr 2024 22:15:33 +0700 Subject: [PATCH] fix: seperate port --- src/handler/net.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/handler/net.go b/src/handler/net.go index 8b051ac..518505c 100644 --- a/src/handler/net.go +++ b/src/handler/net.go @@ -1,8 +1,15 @@ package handler -import "net" +import ( + "net" + "strings" +) func IsInternalIP(ip string) bool { + + parts := strings.Split(ip, ":") + ip = parts[0] + // Parse the IP address ipAddress := net.ParseIP(ip) if ipAddress == nil { @@ -18,7 +25,7 @@ func IsInternalIP(ip string) bool { for _, internalRange := range internalRanges { _, ipNet, err := net.ParseCIDR(internalRange) if err != nil { - return false + continue } if ipNet.Contains(ipAddress) {