python-proxy
python-proxy copied to clipboard
python-proxy如何获取用户来源IP? How to get user source ip?
我想实现根据用户来源IP不同,转发到不同的sock5服务器
I want to realize the different SOCK5 server depending on the user source IP
You have to modify this line: https://github.com/qwj/python-proxy/blob/09d4752f17ed6787e1a073c93980eec019887ee3/pproxy/server.py#L82 to:
roption = choose(remote_ip)
And add this function:
def choose(remote_ip):
if(remote_ip.startswith('192.168.')):
return proxies_by_uri('socks5://192.168.0.1:8080')
else:
return proxies_by_uri('socks5://192.168.0.2:8080')