MCPcopy
hub / github.com/gofiber/fiber / SetProxyURL

Method SetProxyURL

client/client.go:358–373  ·  view source on GitHub ↗

SetProxyURL sets the proxy URL for the client. This affects all subsequent requests.

(proxyURL string)

Source from the content-addressed store, hash-verified

356
357// SetProxyURL sets the proxy URL for the client. This affects all subsequent requests.
358func (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.
376func (c *Client) RetryConfig() *RetryConfig {

Callers 3

Test_Client_SetProxyURLFunction · 0.80

Calls 4

applyDialMethod · 0.95
LockMethod · 0.65
UnlockMethod · 0.65
ErrorfMethod · 0.65

Tested by 3

Test_Client_SetProxyURLFunction · 0.64