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

22 Replies, 1429 Views

Hey! I had the same issue with resty use socks5 proxy. I ended up using a combination of `golang.org/x/net/proxy` and a custom transport. It’s not perfect, but it works.

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: 1 Guest(s)