yo, so i’ve been trying to figure out how to make resty use socks5 proxy for my API requests, and man, it’s been a bit of a headache. like, why isn’t this more straightforward??
i found some docs, but they’re kinda vague. i mean, resty is awesome, but c’mon, where’s the *easy* way to resty use socks5 proxy without jumping through hoops?
anyway, i managed to get it working by tweaking the client settings and using a custom transport. still feels a bit hacky tho. anyone got a cleaner way to resty use socks5 proxy?
pls share if u do, cuz i’m tired of googling and trial-error-ing my way through this. thx!
(also, sorry for typos, typing this on my phone lol)
Hey! I had the same issue with resty use socks5 proxy. Honestly, the docs are kinda vague, but I managed to get it working by using a custom dialer. Here’s a snippet:
```go
dialer := proxy.FromEnvironment()
transport := &http.Transport{DialContext: dialer.DialContext}
client := resty.New().SetTransport(transport)
```
It’s not the cleanest, but it works. Let me know if you need more details!
Hey, I’ve been there too! For resty use socks5 proxy, I found that setting up a custom HTTP client with the proxy settings first, then passing it to resty, works pretty well.
Here’s a quick example:
```go
proxyURL, _ := url.Parse("socks5://proxyaddress:port")
transport := &http.Transport{Proxy: http.ProxyURL(proxyURL)}
client := resty.New().SetTransport(transport)
```
Hope this helps!
yo, thanks for all the replies! i tried the custom dialer approach and it worked like a charm. still feels a bit hacky, but at least it’s working now.
i also checked out the gost library someone mentioned, and it looks promising. gonna give it a try for my next project.
thanks again, y’all saved me a ton of time!
ugh, resty use socks5 proxy is such a headache. i ended up switching to a different library for my API calls because i couldn’t get it to work smoothly.
if you’re open to alternatives, maybe check out `http.Client` with a custom transport? it’s not resty, but it gets the job done.
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!
man, resty use socks5 proxy is such a pain. i ended up using a different approach altogether. i set up a local proxy server that handles the socks5 stuff, and then pointed resty to that.
it’s a bit of a workaround, but it worked for me. maybe give it a try?