Skip to content

Commit

Permalink
bootstrap: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mizzick committed Jul 2, 2024
1 parent 70119b7 commit a7e47a7
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions internal/bootstrap/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (r ParallelResolver) LookupNetIP(
case 0:
return nil, ErrNoResolvers
case 1:
return lookup(ctx, r[0], network, host)
return r[0].LookupNetIP(ctx, network, host)
default:
// Go on.
}
Expand Down Expand Up @@ -101,23 +101,14 @@ func lookupAsync(ctx context.Context, r Resolver, network, host string, resCh ch
// logger in the context.
defer recoverAndLog(ctx, resCh)

addrs, err := lookup(ctx, r, network, host)
addrs, err := r.LookupNetIP(ctx, network, host)
if err != nil {
resCh <- err
} else {
resCh <- addrs
}
}

// lookup tries to lookup ip of host with r.
//
// TODO(e.burkov): Get rid of this function? It only wraps the actual lookup.
func lookup(ctx context.Context, r Resolver, network, host string) (addrs []netip.Addr, err error) {
addrs, err = r.LookupNetIP(ctx, network, host)

return addrs, err
}

// ConsequentResolver is a slice of resolvers that are queried in order until
// the first successful non-empty response, as opposed to just successful
// response requirement in [ParallelResolver].
Expand Down

0 comments on commit a7e47a7

Please sign in to comment.