(ctx context.Context, network, host string)
| 75 | } |
| 76 | |
| 77 | func (p PreferIPv6) LookupNetIP(ctx context.Context, network, host string) ([]netip.Addr, error) { |
| 78 | addrs, err := p.LookupNetIPer.LookupNetIP(ctx, network, host) |
| 79 | if err != nil { |
| 80 | return nil, err |
| 81 | } |
| 82 | slices.SortStableFunc(addrs, func(a, b netip.Addr) int { |
| 83 | return cmp.Compare( |
| 84 | boolToInt(a.Unmap().Is6()), |
| 85 | boolToInt(b.Unmap().Is6()), |
| 86 | ) |
| 87 | }) |
| 88 | return addrs, nil |
| 89 | } |
| 90 | |
| 91 | func Prefer(resolver LookupNetIPer, p Preference) LookupNetIPer { |
| 92 | switch p { |
nothing calls this directly
no test coverage detected