File tree Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Expand file tree Collapse file tree 2 files changed +19
-17
lines changed Original file line number Diff line number Diff line change 77 "encoding/base64"
88 "encoding/json"
99 "fmt"
10+ "net"
1011 "net/http"
1112 "net/url"
1213 "reflect"
3031 contextType = reflect .TypeOf (new (context.Context )).Elem ()
3132
3233 log = logging .Logger ("rpc" )
34+
35+ _defaultHTTPClient = & http.Client {
36+ Transport : & http.Transport {
37+ Proxy : http .ProxyFromEnvironment ,
38+ DialContext : (& net.Dialer {
39+ Timeout : 30 * time .Second ,
40+ KeepAlive : 30 * time .Second ,
41+ DualStack : true ,
42+ }).DialContext ,
43+ ForceAttemptHTTP2 : true ,
44+ MaxIdleConns : 100 ,
45+ MaxIdleConnsPerHost : 100 ,
46+ IdleConnTimeout : 90 * time .Second ,
47+ TLSHandshakeTimeout : 10 * time .Second ,
48+ ExpectContinueTimeout : 1 * time .Second ,
49+ },
50+ }
3351)
3452
3553// ErrClient is an error which occurred on the client side the library
Original file line number Diff line number Diff line change 11package jsonrpc
22
33import (
4- "net"
54 "net/http"
65 "reflect"
76 "time"
@@ -36,22 +35,7 @@ func defaultConfig() Config {
3635
3736 paramEncoders : map [reflect.Type ]ParamEncoder {},
3837
39- httpClient : & http.Client {
40- Transport : & http.Transport {
41- Proxy : http .ProxyFromEnvironment ,
42- DialContext : (& net.Dialer {
43- Timeout : 30 * time .Second ,
44- KeepAlive : 30 * time .Second ,
45- DualStack : true ,
46- }).DialContext ,
47- ForceAttemptHTTP2 : true ,
48- MaxIdleConns : 100 ,
49- MaxIdleConnsPerHost : 100 ,
50- IdleConnTimeout : 90 * time .Second ,
51- TLSHandshakeTimeout : 10 * time .Second ,
52- ExpectContinueTimeout : 1 * time .Second ,
53- },
54- },
38+ httpClient : _defaultHTTPClient ,
5539 }
5640}
5741
You can’t perform that action at this time.
0 commit comments