Browse Source

check ranges bi-directionally

master
Stephen McQuay 2 years ago
parent
commit
f0f51f7f77
Signed by: sm GPG Key ID: 4E4B72F479BA3CE5
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      cidr.go

+ 4
- 1
cidr.go View File

@ -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…
Cancel
Save