func listDHCPServers(vbox VBoxManager) (map[string]*dhcpServer, error) {
	out, err := vbox.vbmOut("list", "dhcpservers")
	if err != nil {
		return nil, err
	}

	m := map[string]*dhcpServer{}
	dhcp := &dhcpServer{}

	err = parseKeyValues(out, reColonLine, func(key, val string) error {
		switch key {
		case "NetworkName":
			dhcp = &dhcpServer{}
			m[val] = dhcp
			dhcp.NetworkName = val
		case "IP":
			dhcp.IPv4.IP = net.ParseIP(val)
		case "upperIPAddress":
			dhcp.UpperIP = net.ParseIP(val)
		case "lowerIPAddress":
			dhcp.LowerIP = net.ParseIP(val)
		case "NetworkMask":
			dhcp.IPv4.Mask = parseIPv4Mask(val)
		case "Enabled":
			dhcp.Enabled = (val == "Yes")
		}

		return nil
	})
	if err != nil {
		return nil, err
	}

	return m, nil
}
func listDHCPServers(vbox VBoxManager) (map[string]*dhcpServer, error) {
	out, err := vbox.vbmOut("list", "dhcpservers")
	if err != nil {
		return nil, err
	}

	m := map[string]*dhcpServer{}
	dhcp := &dhcpServer{}

	err = parseKeyValues(out, reColonLine, func(key, val string) error {
		switch key {
		case "NetworkName":
			dhcp = &dhcpServer{}
			m[val] = dhcp
			dhcp.NetworkName = val
		case "IP":
			dhcp.IPv4.IP = net.ParseIP(val)
		case "upperIPAddress":
			dhcp.UpperIP = net.ParseIP(val)
		case "lowerIPAddress":
			dhcp.LowerIP = net.ParseIP(val)
		case "NetworkMask":
			dhcp.IPv4.Mask = parseIPv4Mask(val)
		case "Enabled":
			dhcp.Enabled = (val == "Yes")
		}

		return nil
	})
	if err != nil {
		return nil, err
	}

	return m, nil
}
func listDHCPServers ( vbox VBoxManager ) ( map [ string ] * dhcpServer , error ) { out , err := vbox . vbmOut ( " " , " " ) if err != nil { return nil , err } m := map [ string ] * dhcpServer { } dhcp := & dhcpServer { } err = parseKeyValues ( out , reColonLine , func ( key , val string ) error { switch key { case " " : dhcp = & dhcpServer { } m [ val ] = dhcp dhcp . NetworkName = val case " " : dhcp . IPv4 . IP = net . ParseIP ( val ) case " " : dhcp . UpperIP = net . ParseIP ( val ) case " " : dhcp . LowerIP = net . ParseIP ( val ) case " " : dhcp . IPv4 . Mask = parseIPv4Mask ( val ) case " " : dhcp . Enabled = ( val == " " ) } return nil } ) if err != nil { return nil , err } return m , nil }
// listDHCPServers lists all DHCP server settings in a map keyed by DHCP.NetworkName.
listDHCPServers lists all DHCP server settings in a map keyed by DHCP . NetworkName .