Slide 21
Slide 21 text
21
OFUOFUJQQBDLBHFͷޓੑ
w ࠓ·ͰOFU*1ܕΛར༻͍ͯͨ͠ػೳͷ͕ͯ͢OFUJQ"EESܕͰఏڙ͞Ε͍ͯΔΘ͚Ͱͳ͍
w OFUJQ"EESܕʹม͢Δϝιου͕Ճ͞Ε͍ͯΔ͜ͱ͋Δ
w 5$1"EES"EES1PSUɺ-PPLVQ/FU*1ͳͲ
func (r *Resolver) LookupNetIP(ctx context.Context, network, host string) ([]netip.Addr, error) {
// TODO(bradfitz): make this efficient, making the internal net package
// type throughout be netip.Addr and only converting to the net.IP slice
// version at the edge. But for now (2021-10-20), this is a wrapper around
// the old way.
ips, err := r.LookupIP(ctx, network, host)
if err != nil {
return nil, err
}
ret := make([]netip.Addr, 0, len(ips))
for _, ip := range ips {
if a, ok := netip.AddrFromSlice(ip); ok {
ret = append(ret, a)
}
}
return ret, nil
}