code: func (ns *NameServer) Init() error {
  	timeout := ns.Timeout
  	if timeout <= 0 {
  		timeout = DefaultResolverTimeout
  	}
  
  	switch strings.ToLower(ns.Protocol) {
  	case "tcp":
  		ns.exchanger = &dnsExchanger{
  			endpoint: ns.Addr,
  			client: &dns.Client{
  				Net:     "tcp",
  				Timeout: timeout,
  			},
  		}
  	case "tls":
  		cfg := &tls.Config{
  			ServerName: ns.Hostname,
  		}
  		if cfg.ServerName == "" {
  			cfg.InsecureSkipVerify = true
  		}
  
  		ns.exchanger = &dnsExchanger{
  			endpoint: ns.Addr,
  			client: &dns.Client{
  				Net:       "tcp-tls",
  				Timeout:   timeout,
  				TLSConfig: cfg,
  			},
  		}
  	case "https":
  		u, err := url.Parse(ns.Addr)
  		if err != nil {
  			return err
  		}
  		cfg := &tls.Config{ServerName: u.Hostname()}
  		transport := &http.Transport{
  			TLSClientConfig:    cfg,
  			DisableCompression: true,
  			MaxIdleConns:       1,
  		}
  		http2.ConfigureTransport(transport)
  
  		ns.exchanger = &dohExchanger{
  			endpoint: u,
  			client: &http.Client{
  				Transport: transport,
  				Timeout:   timeout,
  			},
  		}
  	case "udp":
  		fallthrough
  	default:
  		ns.exchanger = &dnsExchanger{
  			endpoint: ns.Addr,
  			client: &dns.Client{
  				Net:     "udp",
  				Timeout: timeout,
  			},
  		}
  	}
  
  	return nil
  }
docs: // Init initializes the name server.