code: func (n *network) getMatchingSubnet(ip *net.IPNet) *subnet {
  	if ip == nil {
  		return nil
  	}
  	for _, s := range n.subnets {
  		// first check if the mask lengths are the same
  		i, _ := s.subnetIP.Mask.Size()
  		j, _ := ip.Mask.Size()
  		if i != j {
  			continue
  		}
  		if s.subnetIP.IP.Equal(ip.IP) {
  			return s
  		}
  	}
  	return nil
  }
docs: // getMatchingSubnet return the network's subnet that matches the input