Skip to content

Commit f70708d

Browse files
author
Jonney
authored
Merge pull request #1 from qwj/master
merge
2 parents 0aa4e4c + 7fccf8d commit f70708d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

pproxy/__doc__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__title__ = "pproxy"
2-
__version__ = "2.3.5"
2+
__version__ = "2.3.7"
33
__license__ = "MIT"
44
__description__ = "Proxy server that can tunnel among remote servers by regex rules."
55
__keywords__ = "proxy socks http shadowsocks shadowsocksr ssr redirect pf tunnel cipher ssl udp"

pproxy/server.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def schedule(rserver, salgorithm, host_name, port):
5151
else:
5252
raise Exception('Unknown scheduling algorithm') #Unreachable
5353

54-
async def stream_handler(reader, writer, unix, lbind, protos, rserver, cipher, sslserver, authtime=86400*30, block=None, salgorithm='fa', verbose=DUMMY, modstat=lambda r,h:lambda i:DUMMY, **kwargs):
54+
async def stream_handler(reader, writer, unix, lbind, protos, rserver, cipher, sslserver, debug=0, authtime=86400*30, block=None, salgorithm='fa', verbose=DUMMY, modstat=lambda r,h:lambda i:DUMMY, **kwargs):
5555
try:
5656
reader, writer = proto.sslwrap(reader, writer, sslserver, True, None, verbose)
5757
if unix:
@@ -92,6 +92,8 @@ async def stream_handler(reader, writer, unix, lbind, protos, rserver, cipher, s
9292
verbose(f'{str(ex) or "Unsupported protocol"} from {remote_ip}')
9393
try: writer.close()
9494
except Exception: pass
95+
if debug:
96+
raise
9597

9698
async def reuse_stream_handler(reader, writer, unix, lbind, protos, rserver, urserver, block, cipher, salgorithm, verbose=DUMMY, modstat=lambda r,h:lambda i:DUMMY, **kwargs):
9799
try:
@@ -474,7 +476,7 @@ def compile(cls, uri, relay=None):
474476
cipher.plugins.append(plugin)
475477
match = cls.compile_rule(url.query) if url.query else None
476478
if loc:
477-
host_name, _, port = loc.partition(':')
479+
host_name, _, port = loc.rpartition(':')
478480
port = int(port) if port else (22 if 'ssh' in rawprotos else 8080)
479481
else:
480482
host_name = port = None
@@ -531,6 +533,7 @@ def main():
531533
parser.add_argument('-b', dest='block', type=ProxyURI.compile_rule, help='block regex rules')
532534
parser.add_argument('-a', dest='alived', default=0, type=int, help='interval to check remote alive (default: no check)')
533535
parser.add_argument('-s', dest='salgorithm', default='fa', choices=('fa', 'rr', 'rc', 'lc'), help='scheduling algorithm (default: first_available)')
536+
parser.add_argument('-d', dest='debug', action='count', help='turn on debug to see tracebacks (default: no debug)')
534537
parser.add_argument('-v', dest='v', action='count', help='print verbose output')
535538
parser.add_argument('--ssl', dest='sslfile', help='certfile[,keyfile] if server listen in ssl mode')
536539
parser.add_argument('--pac', help='http PAC path')

0 commit comments

Comments
 (0)