dispatchrun / wasi-go

A Go implementation of the WebAssembly System Interface (WASI)
Apache License 2.0
124 stars 7 forks source link

addrinfo: fix address ordering #68

Closed achille-roussel closed 1 year ago

achille-roussel commented 1 year ago

This change introduces a bit more determinism in the behavior of the name resolver.

There were a few issues:

I also added a partial sort of the results so that we put the AF_INET addresses first when they are mixed with AF_INET6 due to the hint being AF_UNSPEC, this helps keep the behavior deterministic; for example, if the client uses the first address that it is returned, it doesn't result in sometimes connecting to an IPv4 and sometimes an IPv6.