(host string)
| 216 | } |
| 217 | |
| 218 | func 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 | |
| 233 | func AddDNSResolveEx(vm *goja.Runtime) error { |
| 234 | return vm.GlobalObject().Set("dnsResolveEx", func(call goja.FunctionCall) goja.Value { |
no test coverage detected