Fix: remove ClientSessionCache and add NextProtos for vmess to fix #1468

This commit is contained in:
Dreamacro
2021-07-03 20:34:44 +08:00
parent 3ca5d17c40
commit 995aa7a8fc
13 changed files with 9 additions and 48 deletions

View File

@ -3,7 +3,6 @@ package dns
import (
"bytes"
"context"
"crypto/tls"
"io/ioutil"
"net"
"net/http"
@ -76,7 +75,6 @@ func newDoHClient(url string, r *Resolver) *dohClient {
return &dohClient{
url: url,
transport: &http.Transport{
TLSClientConfig: &tls.Config{ClientSessionCache: globalSessionCache},
ForceAttemptHTTP2: true,
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
host, port, err := net.SplitHostPort(addr)

View File

@ -2,7 +2,6 @@ package dns
import (
"context"
"crypto/tls"
"errors"
"fmt"
"math/rand"
@ -20,10 +19,6 @@ import (
"golang.org/x/sync/singleflight"
)
var (
globalSessionCache = tls.NewLRUClientSessionCache(64)
)
type dnsClient interface {
Exchange(m *D.Msg) (msg *D.Msg, err error)
ExchangeContext(ctx context.Context, m *D.Msg) (msg *D.Msg, err error)

View File

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