netxlite: improve docs, tests, and code quality (#493)

* netxlite: improve docs, tests, and code quality

* better documentation

* more strict testing of dialer (especially make sure we
document the quirk in https://github.com/ooni/probe/issues/1779
and we have tests to guarantee we don't screw up here)

* introduce NewErrWrapper factory for creating errors so we
have confidence we are creating them correctly

Part of https://github.com/ooni/probe/issues/1591
This commit is contained in:
Simone Basso 2021-09-08 21:19:51 +02:00 committed by GitHub
commit 3cd88debdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 452 additions and 141 deletions

View file

@ -197,11 +197,8 @@ var _ Resolver = &resolverErrWrapper{}
func (r *resolverErrWrapper) LookupHost(ctx context.Context, hostname string) ([]string, error) {
addrs, err := r.Resolver.LookupHost(ctx, hostname)
if err != nil {
return nil, &errorsx.ErrWrapper{
Failure: errorsx.ClassifyResolverError(err),
Operation: errorsx.ResolveOperation,
WrappedErr: err,
}
return nil, errorsx.NewErrWrapper(
errorsx.ClassifyResolverError, errorsx.ResolveOperation, err)
}
return addrs, nil
}