File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 "bytes"
55 "compress/gzip"
66 "context"
7+ "crypto/tls"
78 "errors"
89 "io"
910 "net/http"
@@ -14,9 +15,13 @@ import (
1415
1516// DefaultClient - клиент по умаолчанию для API.
1617var (
18+ cpus = runtime .NumCPU ()
1719 DefaultClient = & http.Client {
1820 Transport : & http.Transport {
19- Proxy : http .ProxyFromEnvironment ,
21+ Proxy : http .ProxyFromEnvironment ,
22+ MaxIdleConns : cpus ,
23+ MaxConnsPerHost : cpus ,
24+ MaxIdleConnsPerHost : cpus ,
2025 },
2126 Timeout : time .Minute ,
2227 }
@@ -147,7 +152,11 @@ type ClientOption func(*ClientV3)
147152func OptionInsecureSkipVerify (b bool ) ClientOption {
148153 return func (c * ClientV3 ) {
149154 if c .client .Transport != nil {
150- (c .client .Transport .(* http.Transport )).TLSClientConfig .InsecureSkipVerify = b
155+ if (c .client .Transport .(* http.Transport )).TLSClientConfig == nil {
156+ (c .client .Transport .(* http.Transport )).TLSClientConfig = & tls.Config {InsecureSkipVerify : b }
157+ } else {
158+ (c .client .Transport .(* http.Transport )).TLSClientConfig .InsecureSkipVerify = b
159+ }
151160 }
152161 }
153162}
You can’t perform that action at this time.
0 commit comments