netxlite: call getaddrinfo and handle platform-specific oddities (#764)
This commit changes our system resolver to call getaddrinfo directly when CGO is enabled. This change allows us to: 1. obtain the CNAME easily 2. obtain the real getaddrinfo retval 3. handle platform specific oddities such as `EAI_NODATA` returned on Android devices See https://github.com/ooni/probe/issues/2029 and https://github.com/ooni/probe/issues/2029#issuecomment-1140258729 in particular. See https://github.com/ooni/probe/issues/2033 for documentation regarding the desire to see `getaddrinfo`'s retval. See https://github.com/ooni/probe/issues/2118 for possible follow-up changes.
This commit is contained in:
parent
62bd62ece1
commit
cf6dbe48e0
36 changed files with 1259 additions and 59 deletions
|
|
@ -54,4 +54,21 @@
|
|||
//
|
||||
// Operations 1, 2, 3, and 4 are used when we perform measurements,
|
||||
// while 5 and 6 are mostly used when speaking with our backend.
|
||||
//
|
||||
// Getaddrinfo usage
|
||||
//
|
||||
// When compiled with CGO_ENABLED=1, this package will link with libc
|
||||
// and call getaddrinfo directly. While this design choice means we will
|
||||
// need to maintain more code, it also allows us to save the correct
|
||||
// getaddrinfo return value, which is hidden by the Go resolver. Also,
|
||||
// this strategy allows us to deal with the Android EAI_NODATA implementation
|
||||
// quirk (see https://github.com/ooni/probe/issues/2029).
|
||||
//
|
||||
// We currently use net.Resolver when CGO_ENABLED=0. A future version of
|
||||
// netxlite MIGHT change this and use a custom UDP resolver in such a
|
||||
// case, to avoid depending on the assumption that /etc/resolver.conf is
|
||||
// present on the target system. See https://github.com/ooni/probe/issues/2118
|
||||
// for more details regarding ongoing plans to bypass net.Resolver when
|
||||
// CGO_ENABLED=0. (If you're reading this piece of documentation and notice
|
||||
// it's not updated, please submit a pull request to update it :-).
|
||||
package netxlite
|
||||
|
|
|
|||
Loading…
Reference in a new issue