How to detect if two Golang net.IPNet objects intersect?
问题 How to detect if there is intersection between two Golang net.IPNet objects? That is, how to check both if the first network is subnet of the second one OR if the second network is subnet of the first one. Does Go provide any utility function ready for this specific task? See test code below. package main import ( "fmt" "net" ) func main() { _, net1, _ := net.ParseCIDR("1.1.1.1/24") _, net2, _ := net.ParseCIDR("1.1.0.2/16") _, net3, _ := net.ParseCIDR("1.1.1.3/25") _, net4, _ := net.ParseCIDR