MCPcopy
hub / github.com/AdguardTeam/dnsproxy / initSubnets

Method initSubnets

internal/cmd/proxy.go:483–501  ·  view source on GitHub ↗

initSubnets sets the DNS64 configuration into conf. TODO(d.kolyshev): Join errors.

(proxyConf *proxy.Config)

Source from the content-addressed store, hash-verified

481//
482// TODO(d.kolyshev): Join errors.
483func (conf *configuration) initSubnets(proxyConf *proxy.Config) (err error) {
484 if proxyConf.UseDNS64 = conf.DNS64; proxyConf.UseDNS64 {
485 for i, p := range conf.DNS64Prefix {
486 var pref netip.Prefix
487 pref, err = netip.ParsePrefix(p)
488 if err != nil {
489 return fmt.Errorf("parsing dns64 prefix at index %d: %w", i, err)
490 }
491
492 proxyConf.DNS64Prefs = append(proxyConf.DNS64Prefs, pref)
493 }
494 }
495
496 if !conf.UsePrivateRDNS {
497 return nil
498 }
499
500 return conf.initPrivateSubnets(proxyConf)
501}
502
503// initSubnets sets the private subnets configuration into conf.
504func (conf *configuration) initPrivateSubnets(proxyConf *proxy.Config) (err error) {

Callers 1

createProxyConfigFunction · 0.80

Calls 1

initPrivateSubnetsMethod · 0.95

Tested by

no test coverage detected