Skip to content

Commit 613c63b

Browse files
authored
DNS DoH h2c Remote: Add verifyPeerCertInNames "fromMitm" support
#4313 (comment)
1 parent d4c7cd0 commit 613c63b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/dns/nameserver_doh.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ func NewDoHNameServer(url *url.URL, dispatcher routing.Dispatcher, queryStrategy
5454
if err != nil {
5555
return nil, err
5656
}
57-
link, err := s.dispatcher.Dispatch(toDnsContext(ctx, s.dohURL), dest)
57+
dnsCtx := toDnsContext(ctx, s.dohURL)
58+
if h2c {
59+
dnsCtx = session.ContextWithMitmAlpn11(dnsCtx, false) // for insurance
60+
dnsCtx = session.ContextWithMitmServerName(dnsCtx, url.Hostname())
61+
}
62+
link, err := s.dispatcher.Dispatch(dnsCtx, dest)
5863
select {
5964
case <-ctx.Done():
6065
return nil, ctx.Err()

0 commit comments

Comments
 (0)