mirror of
https://github.com/Alexey71/opera-proxy.git
synced 2026-05-13 14:11:00 +00:00
use custom CA pool for DoH
This commit is contained in:
+14
-1
@@ -5,8 +5,10 @@ import (
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/ncruces/go-dns"
|
||||
)
|
||||
@@ -50,7 +52,18 @@ begin:
|
||||
parsed.Scheme = "https"
|
||||
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":
|
||||
if port == "" {
|
||||
port = "853"
|
||||
|
||||
Reference in New Issue
Block a user