Skip to content
\n

This listens on my first network, 192.168.1.150, which is fine for now.

\n

But how can I make the proxy redirect traffic to the second network, 10.1.100.10? Is it possible to specify the network interface in some way?

\n

I made a small diagram:

\n
| User uses a proxy      |       ------->      | Proxy input on 192.168.1.150:8899 | \n                                                                                               |\n                                                                                               |\n                                                                                               |\n                                                                                               |\n| Response to the user  |       <-------      | Proxy redirects traffic to 10.1.100.10 | \n
\n

I've tried looking into the source code, and I think my answers lie in 'proxy/core/connection'. However, I'm having trouble figuring out how to use them with override or via a plugin.

\n

Does anyone have any ideas on how to achieve this ?

","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"

The response:

\n

You needed to set the port to '0' so that the machine could choose a random port. Otherwise, multiple sockets would be created with the specified port, causing an error!

\n
def resolve_dns(self, host: str, port: int) -> Tuple[Optional[str], Optional['HostPort']]:\n    return None, (\"192.168.1.150\", 0)\n
","upvoteCount":0,"url":"https://github.com/abhinavsingh/proxy.py/discussions/1416#discussioncomment-9698975"}}}

How to specify the network interface used in our proxy? #1416

Answered by LoickZoty
LoickZoty asked this question in Q&A
Discussion options

You must be logged in to vote

The response:

You needed to set the port to '0' so that the machine could choose a random port. Otherwise, multiple sockets would be created with the specified port, causing an error!

def resolve_dns(self, host: str, port: int) -> Tuple[Optional[str], Optional['HostPort']]:
    return None, ("192.168.1.150", 0)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@LoickZoty
Comment options

@LoickZoty
Comment options

Answer selected by LoickZoty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants