SetRootCertificateFromString adds one or more root certificates from a string to the client's TLS configuration.
(pem string)
| 341 | |
| 342 | // SetRootCertificateFromString adds one or more root certificates from a string to the client's TLS configuration. |
| 343 | func (c *Client) SetRootCertificateFromString(pem string) *Client { |
| 344 | config := c.TLSConfig() |
| 345 | |
| 346 | if config.RootCAs == nil { |
| 347 | config.RootCAs = x509.NewCertPool() |
| 348 | } |
| 349 | |
| 350 | if !config.RootCAs.AppendCertsFromPEM([]byte(pem)) { |
| 351 | c.logger.Panicf("client: %v", ErrFailedToAppendCert) |
| 352 | } |
| 353 | |
| 354 | return c |
| 355 | } |
| 356 | |
| 357 | // SetProxyURL sets the proxy URL for the client. This affects all subsequent requests. |
| 358 | func (c *Client) SetProxyURL(proxyURL string) error { |