mirror of
https://github.com/Alexey71/opera-proxy.git
synced 2026-05-14 14:40:59 +00:00
use custom CA pool for DoH
This commit is contained in:
+14
-1
@@ -5,8 +5,10 @@ import (
|
|||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"errors"
|
"errors"
|
||||||
"net"
|
"net"
|
||||||
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/ncruces/go-dns"
|
"github.com/ncruces/go-dns"
|
||||||
)
|
)
|
||||||
@@ -50,7 +52,18 @@ begin:
|
|||||||
parsed.Scheme = "https"
|
parsed.Scheme = "https"
|
||||||
u = parsed.String()
|
u = parsed.String()
|
||||||
}
|
}
|
||||||
return dns.NewDoHResolver(u, dns.DoHAddresses(net.JoinHostPort(host, port)))
|
return dns.NewDoHResolver(u,
|
||||||
|
dns.DoHAddresses(net.JoinHostPort(host, port)),
|
||||||
|
dns.DoHTransport(&http.Transport{
|
||||||
|
MaxIdleConns: http.DefaultMaxIdleConnsPerHost,
|
||||||
|
IdleConnTimeout: 90 * time.Second,
|
||||||
|
TLSHandshakeTimeout: 10 * time.Second,
|
||||||
|
ForceAttemptHTTP2: true,
|
||||||
|
TLSClientConfig: &tls.Config{
|
||||||
|
RootCAs: caPool,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
)
|
||||||
case "tls", "dot":
|
case "tls", "dot":
|
||||||
if port == "" {
|
if port == "" {
|
||||||
port = "853"
|
port = "853"
|
||||||
|
|||||||
Reference in New Issue
Block a user