I'm writing daemons in Nim, and I fail to get it working with IPv6 My nim code uses a socket created by `newAsyncSocket()` from `asyncnet` and uses `bindAddr` to bind the socket to an address specified on the command-line. The bind address is specified in the form of a hostname and when the hostname represents an IPv6 only address (except for localhost, I don't know why) it fails.
I get: /home/runner/work/stalwart-gw/stalwart-gw/src/stalwart_gw.nim(245) stalwart_gw /home/runner/work/stalwart-gw/stalwart-gw/src/stalwart_gw.nim(65) main /home/runner/.choosenim/toolchains/nim-1.6.10/lib/pure/asyncnet.nim(649) bindAddr /home/runner/.choosenim/toolchains/nim-1.6.10/lib/pure/nativesockets.nim(308) getAddrInfo /home/runner/.choosenim/toolchains/nim-1.6.10/lib/pure/includes/oserr.nim(95) raiseOSError Error: unhandled exception: Additional info: Name or service not known [OSError] Run using ltrace, I get: getaddrinfo("auth-sockapi6", "7999", 0x7ffed82da5a0, 0x7ffed82da558) = -2 Run Reading at the code `bindAddr` is calling `getAddrInfo` with the socket domain for the address family. here I don't know the domain of socket in advance, it can neither be AF_INET nor AF_INET6 and it depends on the hostname. A proper value would be AF_UNSPEC which is not possible. Should I resolve the address family in advance before creating the socket, and depending on the actual address family create the socket with the proper domain?