mirror of
https://github.com/smcquay/cidr/
synced 2024-12-03 21:29: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}
|
||||
}
|
||||
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]
|
||||
last := firstLastIP[j][1]
|
||||
if s.Contains(first) || s.Contains(last) {
|
||||
|
Loading…
Reference in New Issue
Block a user