From 57ecaa8591f51b50e4ea32c13f2a3a0e4f7a4775 Mon Sep 17 00:00:00 2001 From: zu1k Date: Fri, 17 Dec 2021 13:31:08 +0800 Subject: [PATCH] fix ipv4 in ipv6 parse Signed-off-by: zu1k --- cmd/root.go | 3 +-- internal/entity/parse.go | 8 +------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 1f34da6d..e1bca2d4 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -4,10 +4,9 @@ import ( "log" "os" - "github.com/zu1k/nali/internal/constant" - "github.com/spf13/cobra" "github.com/zu1k/nali/internal/app" + "github.com/zu1k/nali/internal/constant" ) var rootCmd = &cobra.Command{ diff --git a/internal/entity/parse.go b/internal/entity/parse.go index 38a6f69c..9738339a 100644 --- a/internal/entity/parse.go +++ b/internal/entity/parse.go @@ -25,13 +25,7 @@ func ParseLine(line string) Entities { } for _, e := range ip6sLoc { text := line[e[0]:e[1]] - if ip, _ := netip.ParseAddr(text); ip.Is4In6() { - tmp = append(tmp, &Entity{ - Loc: e, - Type: TypeIPv4, - Text: ip.Unmap().String(), - }) - } else { + if ip, _ := netip.ParseAddr(text); !ip.Is4In6() { tmp = append(tmp, &Entity{ Loc: e, Type: TypeIPv6,