소스 검색

start ipv6 from 1

0xdcarns 3 년 전
부모
커밋
fed4650b3f
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  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
 }