This repository was archived by the owner on Aug 30, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change 6
6
"compress/zlib"
7
7
"crypto/rand"
8
8
"crypto/tls"
9
+ "crypto/x509"
9
10
"encoding/base64"
10
11
"encoding/hex"
11
12
"encoding/json"
@@ -317,14 +318,31 @@ func newTransport() Transport {
317
318
} else {
318
319
t .Client = & http.Client {
319
320
Transport : & http.Transport {
320
- Proxy : http .ProxyFromEnvironment ,
321
+ Proxy : http .ProxyFromEnvironment ,
321
322
TLSClientConfig : & tls.Config {RootCAs : rootCAs },
322
323
},
323
324
}
324
325
}
325
326
return t
326
327
}
327
328
329
+ // SetRootCAs sets the root CAs for the default *Client instance
330
+ func SetRootCAs (CAs * x509.CertPool ) {
331
+ DefaultClient .SetRootCAs (CAs )
332
+ }
333
+
334
+ // SetRootCAs sets the root CAs for this client instance
335
+ func (client * Client ) SetRootCAs (CAs * x509.CertPool ) {
336
+ t := & HTTPTransport {}
337
+ t .Client = & http.Client {
338
+ Transport : & http.Transport {
339
+ Proxy : http .ProxyFromEnvironment ,
340
+ TLSClientConfig : & tls.Config {RootCAs : CAs },
341
+ },
342
+ }
343
+ client .Transport = t
344
+ }
345
+
328
346
func newClient (tags map [string ]string ) * Client {
329
347
client := & Client {
330
348
Transport : newTransport (),
You can’t perform that action at this time.
0 commit comments