SetProxyURL sets the proxy URL for the client. This affects all subsequent requests.
(proxyURL string)
| 356 | |
| 357 | // SetProxyURL sets the proxy URL for the client. This affects all subsequent requests. |
| 358 | func (c *Client) SetProxyURL(proxyURL string) error { |
| 359 | c.mu.Lock() |
| 360 | defer c.mu.Unlock() |
| 361 | |
| 362 | // Build the fasthttp proxy dialer directly so invalid proxy URLs are returned |
| 363 | // to callers instead of being swallowed by FasthttpHTTPDialer. |
| 364 | dialer := fasthttpproxy.Dialer{ |
| 365 | Config: httpproxy.Config{HTTPProxy: proxyURL, HTTPSProxy: proxyURL}, |
| 366 | } |
| 367 | dialFunc, err := dialer.GetDialFunc(false) |
| 368 | if err != nil { |
| 369 | return fmt.Errorf("client: invalid proxy URL: %w", err) |
| 370 | } |
| 371 | c.applyDial(dialFunc) |
| 372 | return nil |
| 373 | } |
| 374 | |
| 375 | // RetryConfig returns a copy of the current retry configuration. |
| 376 | func (c *Client) RetryConfig() *RetryConfig { |