Skip to content

Commit

Permalink
fix bug: ipv6局域网地址错误显示为INVALID
Browse files Browse the repository at this point in the history
  • Loading branch information
tsosunchia committed Oct 11, 2023
1 parent ed3c158 commit 8b30ef3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ipgeo/ipfilter.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func Filter(ip string) (*IPGeoData, bool) {
default:
}
// 判断是否为v6 且不在2000::/3
if net.ParseIP(ip).To4() == nil && !cidrRangeContains("2000::/3", ip) {
if net.ParseIP(ip).To4() == nil && !cidrRangeContains("2000::/3", ip) && !isFiltered {
asn = ""
whois = "INVALID"
isFiltered = true
Expand Down
2 changes: 1 addition & 1 deletion ipgeo/ipgeo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestXxx(t *testing.T) {
}

func TestFilter(t *testing.T) {
res, err := Filter("::1")
res, err := Filter("fd11::1")
//打印whois信息
fmt.Println(res.Whois)
print(err)
Expand Down

0 comments on commit 8b30ef3

Please sign in to comment.