How to configure resty to use a SOCKS5 proxy for API requests?

22 Replies, 1701 Views

yo, i had the same issue. resty use socks5 proxy is a bit of a mess. i ended up using a custom dialer and transport, but it’s still kinda hacky.

here’s a quick example:

```go
dialer, _ := proxy.SOCKS5("tcp", "proxyaddress:port", nil, proxy.Direct)
transport := &http.Transport{DialContext: dialer.(proxy.ContextDialer).DialContext}
client := resty.New().SetTransport(transport)
```

hope this helps!

Messages In This Thread



Users browsing this thread: 2 Guest(s)