Skip to content

merge #1

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

Merged
merged 2 commits into from
Sep 27, 2020
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pproxy/__doc__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__title__ = "pproxy"
__version__ = "2.3.5"
__version__ = "2.3.7"
__license__ = "MIT"
__description__ = "Proxy server that can tunnel among remote servers by regex rules."
__keywords__ = "proxy socks http shadowsocks shadowsocksr ssr redirect pf tunnel cipher ssl udp"
Expand Down
7 changes: 5 additions & 2 deletions pproxy/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def schedule(rserver, salgorithm, host_name, port):
else:
raise Exception('Unknown scheduling algorithm') #Unreachable

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):
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):
try:
reader, writer = proto.sslwrap(reader, writer, sslserver, True, None, verbose)
if unix:
Expand Down Expand Up @@ -92,6 +92,8 @@ async def stream_handler(reader, writer, unix, lbind, protos, rserver, cipher, s
verbose(f'{str(ex) or "Unsupported protocol"} from {remote_ip}')
try: writer.close()
except Exception: pass
if debug:
raise

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):
try:
Expand Down Expand Up @@ -474,7 +476,7 @@ def compile(cls, uri, relay=None):
cipher.plugins.append(plugin)
match = cls.compile_rule(url.query) if url.query else None
if loc:
host_name, _, port = loc.partition(':')
host_name, _, port = loc.rpartition(':')
port = int(port) if port else (22 if 'ssh' in rawprotos else 8080)
else:
host_name = port = None
Expand Down Expand Up @@ -531,6 +533,7 @@ def main():
parser.add_argument('-b', dest='block', type=ProxyURI.compile_rule, help='block regex rules')
parser.add_argument('-a', dest='alived', default=0, type=int, help='interval to check remote alive (default: no check)')
parser.add_argument('-s', dest='salgorithm', default='fa', choices=('fa', 'rr', 'rc', 'lc'), help='scheduling algorithm (default: first_available)')
parser.add_argument('-d', dest='debug', action='count', help='turn on debug to see tracebacks (default: no debug)')
parser.add_argument('-v', dest='v', action='count', help='print verbose output')
parser.add_argument('--ssl', dest='sslfile', help='certfile[,keyfile] if server listen in ssl mode')
parser.add_argument('--pac', help='http PAC path')
Expand Down