mirror of
https://github.com/smcquay/cidr/
synced 2024-12-04 05:39:36 -08:00
check ranges bi-directionally
This commit is contained in:
parent
08019f5593
commit
f0f51f7f77
5
cidr.go
5
cidr.go
@ -67,7 +67,10 @@ func NoOverlap(subnets []*net.IPNet) error {
|
|||||||
firstLastIP[i] = []net.IP{first, last}
|
firstLastIP[i] = []net.IP{first, last}
|
||||||
}
|
}
|
||||||
for i, s := range subnets {
|
for i, s := range subnets {
|
||||||
for j := i + 1; j < len(subnets); j++ {
|
for j := range subnets {
|
||||||
|
if i == j {
|
||||||
|
continue
|
||||||
|
}
|
||||||
first := firstLastIP[j][0]
|
first := firstLastIP[j][0]
|
||||||
last := firstLastIP[j][1]
|
last := firstLastIP[j][1]
|
||||||
if s.Contains(first) || s.Contains(last) {
|
if s.Contains(first) || s.Contains(last) {
|
||||||
|
Loading…
Reference in New Issue
Block a user