Fix: ALPN should on DoH instead of DoT (#2232)

This commit is contained in:
Skyxim 2022-07-25 12:41:22 +08:00 committed by GitHub
parent a794819869
commit 93400cf44d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -3,6 +3,7 @@ package dns
import ( import (
"bytes" "bytes"
"context" "context"
"crypto/tls"
"io" "io"
"net" "net"
"net/http" "net/http"
@ -102,6 +103,10 @@ func newDoHClient(url, iface string, r *Resolver) *dohClient {
return dialer.DialContext(ctx, "tcp", net.JoinHostPort(ip.String(), port), options...) return dialer.DialContext(ctx, "tcp", net.JoinHostPort(ip.String(), port), options...)
}, },
TLSClientConfig: &tls.Config{
// alpn identifier, see https://tools.ietf.org/html/draft-hoffman-dprive-dns-tls-alpn-00#page-6
NextProtos: []string{"dns"},
},
}, },
} }
} }

View file

@ -63,8 +63,6 @@ func transform(servers []NameServer, resolver *Resolver) []dnsClient {
Client: &D.Client{ Client: &D.Client{
Net: s.Net, Net: s.Net,
TLSConfig: &tls.Config{ TLSConfig: &tls.Config{
// alpn identifier, see https://tools.ietf.org/html/draft-hoffman-dprive-dns-tls-alpn-00#page-6
NextProtos: []string{"dns"},
ServerName: host, ServerName: host,
}, },
UDPSize: 4096, UDPSize: 4096,