Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-proxy如何获取用户来源IP? How to get user source ip? #187

Open
xpfoxs opened this issue Apr 15, 2024 · 1 comment
Open

python-proxy如何获取用户来源IP? How to get user source ip? #187

xpfoxs opened this issue Apr 15, 2024 · 1 comment

Comments

@xpfoxs
Copy link

xpfoxs commented Apr 15, 2024

我想实现根据用户来源IP不同,转发到不同的sock5服务器

I want to realize the different SOCK5 server depending on the user source IP

@Jonney
Copy link
Contributor

Jonney commented Apr 25, 2024

You have to modify this line:

roption = schedule(rserver, salgorithm, host_name, port) or DIRECT

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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants