func validateNoIPCollisions(hif HostInterfaces, hostOnlyNet *net.IPNet, currHostOnlyNets map[string]*hostOnlyNetwork) error {
	hostOnlyByCIDR := map[string]*hostOnlyNetwork{}
	//listHostOnlyAdapters returns a map w/ virtualbox net names as key.  Rekey to CIDRs
	for _, n := range currHostOnlyNets {
		ipnet := net.IPNet{IP: n.IPv4.IP, Mask: n.IPv4.Mask}
		hostOnlyByCIDR[ipnet.String()] = n
	}

	m, err := listHostInterfaces(hif, hostOnlyByCIDR)
	if err != nil {
		return err
	}

	collision, err := checkIPNetCollision(hostOnlyNet, m)
	if err != nil {
		return err
	}

	if collision {
		return ErrNetworkAddrCollision
	}
	return nil
}
func validateNoIPCollisions(hif HostInterfaces, hostOnlyNet *net.IPNet, currHostOnlyNets map[string]*hostOnlyNetwork) error {
	hostOnlyByCIDR := map[string]*hostOnlyNetwork{}
	
	for _, n := range currHostOnlyNets {
		ipnet := net.IPNet{IP: n.IPv4.IP, Mask: n.IPv4.Mask}
		hostOnlyByCIDR[ipnet.String()] = n
	}

	m, err := listHostInterfaces(hif, hostOnlyByCIDR)
	if err != nil {
		return err
	}

	collision, err := checkIPNetCollision(hostOnlyNet, m)
	if err != nil {
		return err
	}

	if collision {
		return ErrNetworkAddrCollision
	}
	return nil
}
func validateNoIPCollisions ( hif HostInterfaces , hostOnlyNet * net . IPNet , currHostOnlyNets map [ string ] * hostOnlyNetwork ) error { hostOnlyByCIDR := map [ string ] * hostOnlyNetwork { } //listHostOnlyAdapters returns a map w/ virtualbox net names as key.  Rekey to CIDRs for _ , n := range currHostOnlyNets { ipnet := net . IPNet { IP : n . IPv4 . IP , Mask : n . IPv4 . Mask } hostOnlyByCIDR [ ipnet . String ( ) ] = n } m , err := listHostInterfaces ( hif , hostOnlyByCIDR ) if err != nil { return err } collision , err := checkIPNetCollision ( hostOnlyNet , m ) if err != nil { return err } if collision { return ErrNetworkAddrCollision } return nil }
// validateNoIPCollisions ensures no conflicts between the host's network interfaces and the vbox host-only network that
// will be used for machine vm instances.
validateNoIPCollisions ensures no conflicts between the host s network interfaces and the vbox host - only network that will be used for machine vm instances .