The biggest problem is to only return a single SocketAddr. In testing ureq 3.x I'm trying to use an nginx server bound to localhost:8080, and it turns out the server is only listening to IPv4. However macOS resolves localhost primarily to IPv6. It seems overly simplistic to return a single address. We need to return "a number" of addresses that can be attempted in turn and check for the Io(Os { code: 61, kind: ConnectionRefused, message: "Connection refused" }) error to try the next.
smallvec is already a dep (via hoot), I suggest we use a fixed number of address slots as return type via SmallVec. Something like 10-16 would be enough.
This is the current Resolver trait.
The biggest problem is to only return a single
SocketAddr
. In testing ureq 3.x I'm trying to use an nginx server bound tolocalhost:8080
, and it turns out the server is only listening to IPv4. However macOS resolveslocalhost
primarily to IPv6. It seems overly simplistic to return a single address. We need to return "a number" of addresses that can be attempted in turn and check for theIo(Os { code: 61, kind: ConnectionRefused, message: "Connection refused" })
error to try the next.