MCPcopy Index your code
hub / github.com/foxcpp/maddy / NewExtResolver

Function NewExtResolver

framework/dns/dnssec.go:376–403  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

374}
375
376func NewExtResolver() (*ExtResolver, error) {
377 cfg, err := dns.ClientConfigFromFile("/etc/resolv.conf")
378 if err != nil {
379 return nil, err
380 }
381
382 if overrideServ != "" && overrideServ != "system-default" {
383 host, port, err := net.SplitHostPort(overrideServ)
384 if err != nil {
385 panic(err)
386 }
387 cfg.Servers = []string{host}
388 cfg.Port = port
389 }
390
391 if len(cfg.Servers) == 0 {
392 cfg.Servers = []string{"127.0.0.1"}
393 }
394
395 cl := new(dns.Client)
396 cl.Dialer = &net.Dialer{
397 Timeout: time.Duration(cfg.Timeout) * time.Second,
398 }
399 return &ExtResolver{
400 cl: cl,
401 Cfg: cfg,
402 }, nil
403}

Callers

nothing calls this directly

Calls 1

DurationMethod · 0.80

Tested by

no test coverage detected