author | Alberto Bertogli
<albertito@blitiri.com.ar> 2023-01-26 11:17:09 UTC |
committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2023-01-27 10:29:48 UTC |
parent | 9edbd85b6ca51c6073c5d8f218fc804a7eddf2a8 |
internal/dnsserver/server.go | +1 | -2 |
diff --git a/internal/dnsserver/server.go b/internal/dnsserver/server.go index e26c6dd..395a2f7 100644 --- a/internal/dnsserver/server.go +++ b/internal/dnsserver/server.go @@ -7,7 +7,6 @@ import ( "encoding/binary" "fmt" "net" - "strings" "sync" "blitiri.com.ar/go/dnss/internal/trace" @@ -80,7 +79,7 @@ func (s *Server) Handler(w dns.ResponseWriter, r *dns.Msg) { // - There's only one question in the request, to keep things simple. // - The question is unqualified (only one '.' in the name). useUnqUpstream := s.unqUpstream != "" && - strings.Count(r.Question[0].Name, ".") <= 1 + dns.CountLabel(r.Question[0].Name) <= 1 if useUnqUpstream { u, err := dns.Exchange(r, s.unqUpstream) if err == nil {