Skip to content

Commit

Permalink
fix ipv4 in ipv6 parse
Browse files Browse the repository at this point in the history
Signed-off-by: zu1k <i@lgf.im>
  • Loading branch information
zu1k committed Dec 17, 2021
1 parent c8b3130 commit 57ecaa8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
3 changes: 1 addition & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
8 changes: 1 addition & 7 deletions internal/entity/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 57ecaa8

Please sign in to comment.