ipaddr
ipaddr copied to clipboard
Aggregate function cause error
Aggregate function with specific prefix list cause the error. Interesting thing is that commenting any of subnets makes program work correct.
https://go.dev/play/p/a83OovyO0mV
package main
import (
"net"
"github.com/mikioh/ipaddr"
)
func main() {
subnets := []string{
"109.233.200.0/22",
"109.233.204.0/22",
"109.233.208.0/21",
"109.233.224.0/21",
"109.234.36.0/22",
"109.234.128.0/21",
"109.234.152.0/21",
"109.235.24.0/21",
"109.235.88.0/21",
"109.235.160.0/21",
"109.235.184.0/21",
"146.185.208.0/22",
"178.213.75.0/24",
}
var prefixes []ipaddr.Prefix
for _, v := range subnets {
_, cidr, _ := net.ParseCIDR(v)
p := ipaddr.NewPrefix(cidr)
prefixes = append(prefixes, *p)
}
ipaddr.Aggregate(prefixes)
}