true = on success, or false = on error (invalid input)
SocketAddress sockAddr; assert(parseSocketAddress("127.0.0.1:8080", sockAddr)); assert(sockAddr == SocketAddress(SocketAddress.Type.ipv4, "127.0.0.1", 8080)); assert(parseSocketAddress("127.0.0.1", sockAddr)); assert(sockAddr == SocketAddress(SocketAddress.Type.ipv4, "127.0.0.1", int.min)); assert(parseSocketAddress("[::]:993", sockAddr)); assert(sockAddr == SocketAddress(SocketAddress.Type.ipv6, "::", 993)); assert(parseSocketAddress("[::1]", sockAddr)); assert(sockAddr == SocketAddress(SocketAddress.Type.ipv6, "::1", int.min)); assert(parseSocketAddress("/var/run/myapp.sock", sockAddr)); assert(sockAddr == SocketAddress(SocketAddress.Type.unixDomain, "/var/run/myapp.sock", int.min)); assert(!parseSocketAddress("myapp.sock", sockAddr)); assert(!parseSocketAddress("::1", sockAddr)); assert(!parseSocketAddress("http://127.0.0.1", sockAddr));
Socket address triage and parsing function
Determines the type (IPv4, IPv6, Unix Domain Socket etc.) of a socket and parses it according to the rules mentioned in this module’s description.