mikekonan / exchange-proxy

exchange-proxy
GNU General Public License v3.0
110 stars 31 forks source link

Let specify the listening interface and / or ip #22

Closed skrew closed 7 months ago

skrew commented 2 years ago

Hi,

I have a server with multiple IPV4, i would like to launch the proxy on all available ips / interfaces instead of 0.0.0.0, so i can use more than 7-8 bots (more than this number will make the ip banned by cloudflare)

EG: i can use a specific ip with curl like curl --interface vint0 ifconfig.me

Edit: i have tested by changing the code:

panic(fasthttp.ListenAndServe(fmt.Sprintf(":%d", port), router.HandleRequest)) with panic(fasthttp.ListenAndServe(fmt.Sprintf("x.x.x.x:%d", port), router.HandleRequest))

but it doesn't works, the ip used is still my "default" ip (i can see that with the cloudflare ban which display the ip used) I don't know if you can use something like SO_BINDTODEVICE with your go libs ?

Edit2: Found that, idk if it can help you: https://github.com/valyala/fasthttp/issues/759

mikekonan commented 2 years ago

I will add it in the next release. For now, you can use docker binding.

mikekonan commented 2 years ago

Just read this again, so there are two HTTP clients that proxy using. One is from kucoin SDK(used for candles) and the other is fasthttp(used for proxying transparently other requests). The first one does not allow to setting a Localaddr

mikekonan commented 2 years ago

Will cover that after will replacing crappy kucoin-sdk with the pure WebSockets client.