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

Function dnsResolveEx

jsext/addrutil.go:218–231  ·  view source on GitHub ↗
(host string)

Source from the content-addressed store, hash-verified

216}
217
218func dnsResolveEx(host string) []netip.Addr {
219 ctx, cl := context.WithTimeout(context.Background(), 5*time.Second)
220 defer cl()
221 // lookup "ip" network for better cache coherence with other lookups,
222 // even though we actually interested only in IPv4 only
223 addrs, err := DefaultResolver.LookupNetIP(ctx, "ip", host)
224 if err != nil {
225 return nil
226 }
227 for i := range addrs {
228 addrs[i] = addrs[i].Unmap()
229 }
230 return addrs
231}
232
233func AddDNSResolveEx(vm *goja.Runtime) error {
234 return vm.GlobalObject().Set("dnsResolveEx", func(call goja.FunctionCall) goja.Value {

Callers 2

AddDNSResolveExFunction · 0.85
AddIsResolvableExFunction · 0.85

Calls 1

LookupNetIPMethod · 0.65

Tested by

no test coverage detected