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

Method LookupNetIP

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

Source from the content-addressed store, hash-verified

57}
58
59func (p PreferIPv4) LookupNetIP(ctx context.Context, network, host string) ([]netip.Addr, error) {
60 addrs, err := p.LookupNetIPer.LookupNetIP(ctx, network, host)
61 if err != nil {
62 return nil, err
63 }
64 slices.SortStableFunc(addrs, func(a, b netip.Addr) int {
65 return cmp.Compare(
66 boolToInt(a.Unmap().Is4()),
67 boolToInt(b.Unmap().Is4()),
68 )
69 })
70 return addrs, nil
71}
72
73type PreferIPv6 struct {
74 LookupNetIPer

Callers

nothing calls this directly

Calls 2

boolToIntFunction · 0.85
LookupNetIPMethod · 0.65

Tested by

no test coverage detected