if no dns then no resolver nor dig nor nothin

master
Bel LaPointe 2022-12-26 13:59:29 -05:00
parent a690dd2f9a
commit 9a60d782e3
1 changed files with 4 additions and 1 deletions

View File

@ -32,7 +32,7 @@ func NewServer(c *Config) *Server {
},
}
if c.DNS == "" {
resolver = &net.Resolver{}
resolver = nil
}
transport := &http.Transport{}
transport.TLSClientConfig = &tls.Config{
@ -133,6 +133,9 @@ func (s *Server) xfer(ctx context.Context, w io.Writer, r io.ReadCloser) {
}
func (s *Server) dig(ctx context.Context, host string) (string, error) {
if s.resolver == nil {
return host, nil
}
search := host
search = strings.TrimPrefix(search, "https://")
search = strings.TrimPrefix(search, "http://")