Skip to content

Commit 9f8be10

Browse files
author
zu1k
committed
fix ipv4 in ipv6 parse
Signed-off-by: zu1k <[email protected]>
1 parent ba5e887 commit 9f8be10

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

cmd/root.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import (
44
"log"
55
"os"
66

7-
"github.com/zu1k/nali/internal/constant"
8-
97
"github.com/spf13/cobra"
108
"github.com/zu1k/nali/internal/app"
9+
"github.com/zu1k/nali/internal/constant"
1110
)
1211

1312
var rootCmd = &cobra.Command{

internal/entity/parse.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,7 @@ func ParseLine(line string) Entities {
2525
}
2626
for _, e := range ip6sLoc {
2727
text := line[e[0]:e[1]]
28-
if ip, _ := netip.ParseAddr(text); ip.Is4In6() {
29-
tmp = append(tmp, &Entity{
30-
Loc: e,
31-
Type: TypeIPv4,
32-
Text: ip.Unmap().String(),
33-
})
34-
} else {
28+
if ip, _ := netip.ParseAddr(text); !ip.Is4In6() {
3529
tmp = append(tmp, &Entity{
3630
Loc: e,
3731
Type: TypeIPv6,

0 commit comments

Comments
 (0)