func (i IPNet) Covers(n net.IPNet) bool {
	if !i.Contains(n.IP) {
		return false
	}  
	nPrefixLen, _ := n.Mask.Size()
	iPrefixLen, _ := i.Mask.Size()
	return iPrefixLen <= nPrefixLen
}
Covers returns true if the whole of n is covered by this CIDR.
package net
import (
	"encoding/json"
	"math/big"
	"net"
)
type IPNet struct {
	net.IPNet
}
func (i IPNet) MarshalJSON() ([]byte, error) {
	return json.Marshal(i.String())
}
func (i *IPNet) UnmarshalJSON(b []byte) error {
	var s string
	if err := json.Unmarshal(b, &s); err != nil {
		return err
	}
	ip, ipnet, err := ParseCIDROrIP(s)
	if err != nil {
		return err
	}
	i.IP = ip.IP
	i.Mask = ipnet.Mask
	return nil
}
func (i *IPNet) Version() int {
	if i.IP.To4() != nil {
		return 4
	} else if len(i.IP) == net.IPv6len {
		return 6
	}
	return 0
}
func (i IPNet) IsNetOverlap(n net.IPNet) bool {
	return n.Contains(i.IP) || i.Contains(n.IP)
}