qwj / python-proxy

HTTP/HTTP2/HTTP3/Socks4/Socks5/Shadowsocks/ShadowsocksR/SSH/Redirect/Pf TCP/UDP asynchronous tunnel proxy implemented in Python 3 asyncio.
MIT License
2.01k stars 335 forks source link

Support multiple outbound rservers #10

Closed thestick613 closed 6 years ago

thestick613 commented 6 years ago

Can i load-balance between multiple rservers (which have the same protocol)?

-r http://server1:8080#user:password,http://server2:8080:user:password should forward half of the connctions to server1 and half to server2. I didn't find any support for something like this in the source.

qwj commented 6 years ago

This is a good idea. Currently pproxy doesn't have load-balancer. But you can use "-a ALIVED" to test multiple "-r" server if it is alive, and choose the first alive rserver. I will add load-balance feature soon.

On Wed, Sep 19, 2018 at 8:56 PM thestick613 notifications@github.com wrote:

Can i load-balance between multiple rservers (which have the same protocol)?

-r http://server1:8080#user:password,http://server2:8080:user:password should forward half of the connctions to server1 and half to server2. I didn't find any support for something like this in the source.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/qwj/python-proxy/issues/10, or mute the thread https://github.com/notifications/unsubscribe-auth/AEBnhLO9dnxIGWyd48sqKYovUUmEL2fZks5ucj8VgaJpZM4WwG0L .

txdywy commented 6 years ago

interesting idea!

Qian Wenjie notifications@github.com 于 2018年9月19日周三 22:10写道:

This is a good idea. Currently pproxy doesn't have load-balancer. But you can use "-a ALIVED" to test multiple "-r" server if it is alive, and choose the first alive rserver. I will add load-balance feature soon.

On Wed, Sep 19, 2018 at 8:56 PM thestick613 notifications@github.com wrote:

Can i load-balance between multiple rservers (which have the same protocol)?

-r http://server1:8080#user:password,http://server2:8080:user:password should forward half of the connctions to server1 and half to server2. I didn't find any support for something like this in the source.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/qwj/python-proxy/issues/10, or mute the thread < https://github.com/notifications/unsubscribe-auth/AEBnhLO9dnxIGWyd48sqKYovUUmEL2fZks5ucj8VgaJpZM4WwG0L

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/qwj/python-proxy/issues/10#issuecomment-422818626, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3yC7wdR7-_XB_svI4193Lt5NNCMYUTks5uclA-gaJpZM4WwG0L .

qwj commented 6 years ago

you can upgrade to version v1.7.3 to enable load-balance feature. specify multiple -r and a scheduling algorithm (-s {fa,rr,rc,lc}). default scheduling algorithm is fa (first_available) with no load-balance. example:

$ sudo pproxy -ul tunnel://:53 -ur tunnel://8.8.8.8:53 -ur tunnel://8.8.4.4:53 -ur tunnel://114.114.114.114:53 -s rr -vv Serving on UDP :53 by tunnel UDP tunnel ::1:61606 -> 8.8.8.8:53 UDP tunnel ::1:62030 -> 8.8.4.4:53 UDP tunnel ::1:58617 -> 114.114.114.114:53 UDP tunnel ::1:50910 -> 8.8.8.8:53 UDP tunnel ::1:55309 -> 8.8.4.4:53