mirror of
https://github.com/fumiama/terasu.git
synced 2026-06-24 23:00:27 +08:00
feat(http): use proxy from env by default
This commit is contained in:
@@ -34,6 +34,7 @@ var lookupTable = ttl.NewCache[string, []string](time.Hour)
|
|||||||
|
|
||||||
var DefaultClient = http.Client{
|
var DefaultClient = http.Client{
|
||||||
Transport: &http.Transport{
|
Transport: &http.Transport{
|
||||||
|
Proxy: http.ProxyFromEnvironment,
|
||||||
DialTLSContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
DialTLSContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
|
||||||
if defaultDialer.Timeout != 0 {
|
if defaultDialer.Timeout != 0 {
|
||||||
var cancel context.CancelFunc
|
var cancel context.CancelFunc
|
||||||
@@ -101,6 +102,11 @@ var DefaultClient = http.Client{
|
|||||||
}
|
}
|
||||||
return tlsConn, err
|
return tlsConn, err
|
||||||
},
|
},
|
||||||
|
ForceAttemptHTTP2: true,
|
||||||
|
MaxIdleConns: 100,
|
||||||
|
IdleConnTimeout: 90 * time.Second,
|
||||||
|
TLSHandshakeTimeout: 10 * time.Second,
|
||||||
|
ExpectContinueTimeout: 1 * time.Second,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user