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

relay requested port to destination for SimpleProxy #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pproxy/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def udp_packet_unpack(self, data):
data = self.cipher.datagram.decrypt(data) if self.cipher else data
return self.jump.udp_packet_unpack(self.rproto.udp_unpack(data))
def destination(self, host, port):
return self.host_name, self.port
return self.host_name, self.port if self.port != 0 else port
def udp_prepare_connection(self, host, port, data):
data = self.jump.udp_prepare_connection(host, port, data)
whost, wport = self.jump.destination(host, port)
Expand All @@ -289,7 +289,7 @@ def wait_open_connection(self, host, port, local_addr, family):
if self.unix:
return asyncio.open_unix_connection(path=self.bind)
else:
return asyncio.open_connection(host=self.host_name, port=self.port, local_addr=local_addr, family=family)
return asyncio.open_connection(host=self.host_name, port=self.port if self.port != 0 else port, local_addr=local_addr, family=family)
async def prepare_connection(self, reader_remote, writer_remote, host, port):
reader_remote, writer_remote = proto.sslwrap(reader_remote, writer_remote, self.sslclient, False, self.host_name)
_, writer_cipher_r = await prepare_ciphers(self.cipher, reader_remote, writer_remote, self.bind)
Expand Down