Pull request: dnsforward: add doq alpn

Merge in DNS/adguard-home from 4592-doq-alpn to master

Squashed commit of the following:

commit 5985445dbf5158ae1e5b0235b404dd188c856e60
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu May 26 16:42:06 2022 +0200

    dnsforward: add doq alpn

commit 9dcd6fee615a1a5ac1f80641ac16c18371b67096
Merge: 2564c870 c3d5fcc6
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu May 26 15:24:07 2022 +0200

    Merge remote-tracking branch 'origin/master' into 4592-doq-alpn

commit 2564c870e704ff453d0ad2fb22fa295ef725dd13
Author: Dimitry Kolyshev <dkolyshev@adguard.com>
Date:   Thu May 26 15:20:16 2022 +0200

    dnsforward: add doq alpn
This commit is contained in:
Dimitry Kolyshev
2022-05-26 17:53:11 +03:00
parent c3d5fcc669
commit 756c932e37
2 changed files with 42 additions and 5 deletions

View File

@@ -260,9 +260,8 @@ func (s *Server) processDDRQuery(ctx *dnsContext) (rc resultCode) {
}
if question.Name == ddrHostFQDN {
// TODO(a.garipov): Check DoQ support in next RFC drafts.
if s.dnsProxy.TLSListenAddr == nil && s.dnsProxy.HTTPSListenAddr == nil ||
question.Qtype != dns.TypeSVCB {
if s.dnsProxy.TLSListenAddr == nil && s.dnsProxy.HTTPSListenAddr == nil &&
s.dnsProxy.QUICListenAddr == nil || question.Qtype != dns.TypeSVCB {
d.Res = s.makeResponse(d.Req)
return resultCodeFinish
@@ -314,6 +313,22 @@ func (s *Server) makeDDRResponse(req *dns.Msg) (resp *dns.Msg) {
resp.Answer = append(resp.Answer, ans)
}
for _, addr := range s.dnsProxy.QUICListenAddr {
values := []dns.SVCBKeyValue{
&dns.SVCBAlpn{Alpn: []string{"doq"}},
&dns.SVCBPort{Port: uint16(addr.Port)},
}
ans := &dns.SVCB{
Hdr: s.hdr(req, dns.TypeSVCB),
Priority: 3,
Target: domainName,
Value: values,
}
resp.Answer = append(resp.Answer, ans)
}
return resp
}