1
0
mirror of https://github.com/fumiama/terasu.git synced 2026-06-05 01:00:23 +08:00

feat(http): use proxy from env by default

This commit is contained in:
源文雨
2024-07-10 18:53:34 +09:00
parent 547a591149
commit 67a8daa3a9

View File

@@ -34,6 +34,7 @@ var lookupTable = ttl.NewCache[string, []string](time.Hour)
var DefaultClient = http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialTLSContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
if defaultDialer.Timeout != 0 {
var cancel context.CancelFunc
@@ -101,6 +102,11 @@ var DefaultClient = http.Client{
}
return tlsConn, err
},
ForceAttemptHTTP2: true,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
},
}