|
|
@ -10,8 +10,9 @@ import (
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/fangdingjun/go-log"
|
|
|
|
"github.com/fangdingjun/go-log"
|
|
|
|
nghttp2 "github.com/fangdingjun/nghttp2-go"
|
|
|
|
//nghttp2 "github.com/fangdingjun/nghttp2-go"
|
|
|
|
"github.com/miekg/dns"
|
|
|
|
"github.com/miekg/dns"
|
|
|
|
|
|
|
|
"golang.org/x/net/http2"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var dnsClientTCP *dns.Client
|
|
|
|
var dnsClientTCP *dns.Client
|
|
|
@ -108,13 +109,13 @@ func initDNSClient(c *conf) {
|
|
|
|
Net: "https",
|
|
|
|
Net: "https",
|
|
|
|
Timeout: time.Duration(c.UpstreamTimeout) * time.Second,
|
|
|
|
Timeout: time.Duration(c.UpstreamTimeout) * time.Second,
|
|
|
|
HTTPClient: &http.Client{
|
|
|
|
HTTPClient: &http.Client{
|
|
|
|
Transport: &nghttp2.Transport{
|
|
|
|
Transport: &http2.Transport{
|
|
|
|
DialTLS: func(network, addr string, cfg *tls.Config) (*tls.Conn, error) {
|
|
|
|
DialTLS: func(network, addr string, cfg *tls.Config) (net.Conn, error) {
|
|
|
|
log.Debugln("dial to", network, addr)
|
|
|
|
log.Debugln("dial to", network, addr)
|
|
|
|
conn, err := tls.DialWithDialer(dialer, network, addr, cfg)
|
|
|
|
conn, err := tls.DialWithDialer(dialer, network, addr, cfg)
|
|
|
|
return conn, err
|
|
|
|
return conn, err
|
|
|
|
},
|
|
|
|
},
|
|
|
|
TLSConfig: &tls.Config{
|
|
|
|
TLSClientConfig: &tls.Config{
|
|
|
|
InsecureSkipVerify: c.UpstreamInsecure,
|
|
|
|
InsecureSkipVerify: c.UpstreamInsecure,
|
|
|
|
NextProtos: []string{"h2"},
|
|
|
|
NextProtos: []string{"h2"},
|
|
|
|
},
|
|
|
|
},
|
|
|
|