             throw SocketAddressError.unsupported
         }
     }
-
 }
 

    import Glibc
#endif

public enum SocketAddressError: Error {
    case unknown
    case unsupported
    case unixDomainSocketPathTooLong
}

public enum SocketAddress: CustomStringConvertible {
    case v4(address: sockaddr_in, host: String)
    case v6(address: sockaddr_in6, host: String)
    case unixDomainSocket(address: sockaddr_un)

    public var description: String {
        let port: String
        let host: String?

        return .unixDomainSocket(address: addr)
    }

    /// Creates a new `SocketAddress` for the given host (which will be resolved) and port.
    ///
    /// - parameters:
    ///       - host: the hostname which should be resolved.
    ///       - port: the port itself
    /// - returns: the `SocketAddress` for the host / port pair.
    /// - throws: a `SocketAddressError.unknown` if we could not resolve the `host`, or `SocketAddressError.unsupported` if the address itself is not supported (yet).
    public static func newAddressResolving(host: String, port: Int32) throws -> SocketAddress {
        var info: UnsafeMutablePointer<addrinfo>?
        
        /* FIXME: this is blocking! */
        if getaddrinfo(host, String(port), nil, &info) != 0 {
            throw SocketAddressError.unknown(host: host, port: port)
        }
        
        defer {
