Browse Source

start ipv6 from 1

0xdcarns 3 năm trước cách đây
mục cha
commit
fed4650b3f
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      logic/ips/ips.go

+ 6 - 0
logic/ips/ips.go

@@ -42,6 +42,12 @@ func GetFirstAddr6(cidr6 string) (*ipaddr.IPAddress, error) {
 		return nil, fmt.Errorf("invalid IPv6 CIDR provided to GetFirstAddr6")
 	}
 	lower := currentCidr.GetLower()
+	ipParts := strings.Split(lower.GetNetIPAddr().IP.String(), "::")
+	if len(ipParts) == 2 {
+		if len(ipParts[len(ipParts)-1]) == 0 {
+			lower = lower.Increment(1)
+		}
+	}
 	return lower, nil
 }