Skip to content

Commit

Permalink
dnsforward: imp code
Browse files Browse the repository at this point in the history
  • Loading branch information
EugeneOne1 committed May 30, 2022
1 parent b0508ff commit 047155b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions internal/dnsforward/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
11 changes: 7 additions & 4 deletions internal/dnsforward/dns_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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},
Expand All @@ -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},
Expand Down

0 comments on commit 047155b

Please sign in to comment.