From 047155b585a1c762d709874f44abb2d8c5a9dbca Mon Sep 17 00:00:00 2001 From: Eugene Burkov Date: Mon, 30 May 2022 15:34:38 +0300 Subject: [PATCH] dnsforward: imp code --- internal/dnsforward/dns.go | 2 ++ internal/dnsforward/dns_test.go | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/internal/dnsforward/dns.go b/internal/dnsforward/dns.go index 4a163fc84ca..2865bc84997 100644 --- a/internal/dnsforward/dns.go +++ b/internal/dnsforward/dns.go @@ -278,6 +278,8 @@ func (s *Server) processDDRQuery(ctx *dnsContext) (rc resultCode) { // makeDDRResponse creates DDR answer according to server configuration. func (s *Server) makeDDRResponse(req *dns.Msg) (resp *dns.Msg) { resp = s.makeResponse(req) + // TODO(e.burkov): Think about stroing the FQDN version of the server's + // name somewhere. domainName := dns.Fqdn(s.conf.ServerName) for _, addr := range s.dnsProxy.HTTPSListenAddr { diff --git a/internal/dnsforward/dns_test.go b/internal/dnsforward/dns_test.go index 94c7bd7fe62..129e3c2f05c 100644 --- a/internal/dnsforward/dns_test.go +++ b/internal/dnsforward/dns_test.go @@ -14,12 +14,15 @@ import ( "github.com/stretchr/testify/require" ) -const ddrTestDomainName = "dns.example.net" +const ( + ddrTestDomainName = "dns.example.net" + ddrTestFQDN = ddrTestDomainName + "." +) func TestServer_ProcessDDRQuery(t *testing.T) { dohSVCB := &dns.SVCB{ Priority: 1, - Target: dns.Fqdn(ddrTestDomainName), + Target: ddrTestFQDN, Value: []dns.SVCBKeyValue{ &dns.SVCBAlpn{Alpn: []string{"h2"}}, &dns.SVCBPort{Port: 8044}, @@ -29,7 +32,7 @@ func TestServer_ProcessDDRQuery(t *testing.T) { dotSVCB := &dns.SVCB{ Priority: 2, - Target: dns.Fqdn(ddrTestDomainName), + Target: ddrTestFQDN, Value: []dns.SVCBKeyValue{ &dns.SVCBAlpn{Alpn: []string{"dot"}}, &dns.SVCBPort{Port: 8043}, @@ -38,7 +41,7 @@ func TestServer_ProcessDDRQuery(t *testing.T) { doqSVCB := &dns.SVCB{ Priority: 3, - Target: dns.Fqdn(ddrTestDomainName), + Target: ddrTestFQDN, Value: []dns.SVCBKeyValue{ &dns.SVCBAlpn{Alpn: []string{"doq"}}, &dns.SVCBPort{Port: 8042},