def get_host_details(host_string):
    """Parse a string to get user, protocol, host, etc.

    Args:
        host_string (str): the string
    Returns:
        dict: a dict containing the differnt parts
    """
    if not host_string:
        return {}
    username = None
    protocol = None
    host = None
    port = None
    if '://' in host_string:
        protocol, host = host_string.split('://')
    else:
        host = host_string
    if '@' in host:
        username, host = host.split('@')
    if ':' in host:
        host, port = host.split(':')
    result = {}
    if protocol:
        result['protocol'] = protocol
    if username:
        result['user'] = username
    if host:
        result['host'] = host
    if port:
        result['port'] = int(port)
    return result
