MCPcopy Create free account
hub / github.com/SenseUnit/dumbproxy / LookupNetIP

Method LookupNetIP

resolver/prefer.go:77–89  ·  view source on GitHub ↗
(ctx context.Context, network, host string)

Source from the content-addressed store, hash-verified

75}
76
77func (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
91func Prefer(resolver LookupNetIPer, p Preference) LookupNetIPer {
92 switch p {

Callers

nothing calls this directly

Calls 2

boolToIntFunction · 0.85
LookupNetIPMethod · 0.65

Tested by

no test coverage detected