|
2 | 2 | from pproxy import proto |
3 | 3 |
|
4 | 4 | __title__ = 'pproxy' |
5 | | -__version__ = "1.5" |
| 5 | +__version__ = "1.5.1" |
6 | 6 | __description__ = "Proxy server that can tunnel among remote servers by regex rules." |
7 | 7 | __author__ = "Qian Wenjie" |
8 | 8 | __license__ = "MIT License" |
@@ -92,11 +92,11 @@ async def check_server_alive(interval, rserver, verbose): |
92 | 92 | reader, writer = await asyncio.wait_for(remote.connect(), timeout=SOCKET_TIMEOUT) |
93 | 93 | except Exception as ex: |
94 | 94 | if remote.alive: |
95 | | - verbose(f'{remote.bind}: OFFLINE') |
| 95 | + verbose(f'{remote.bind} -> OFFLINE') |
96 | 96 | remote.alive = False |
97 | 97 | continue |
98 | 98 | if not remote.alive: |
99 | | - verbose(f'{remote.bind}: ONLINE') |
| 99 | + verbose(f'{remote.bind} -> ONLINE') |
100 | 100 | remote.alive = True |
101 | 101 | try: |
102 | 102 | writer.close() |
@@ -156,7 +156,7 @@ def main(): |
156 | 156 | parser.add_argument('-i', dest='listen', default=[], action='append', type=uri_compile, help='proxy server setting uri (default: http+socks://:8080/)') |
157 | 157 | parser.add_argument('-r', dest='rserver', default=[], action='append', type=uri_compile, help='remote server setting uri (default: direct)') |
158 | 158 | parser.add_argument('-b', dest='block', type=pattern_compile, help='block regex rules') |
159 | | - parser.add_argument('-a', dest='alive', default=0, type=int, help='interval to check remote alive (default: no check)') |
| 159 | + parser.add_argument('-a', dest='alived', default=0, type=int, help='interval to check remote alive (default: no check)') |
160 | 160 | parser.add_argument('-v', dest='v', action='store_true', help='print verbose output') |
161 | 161 | parser.add_argument('--ssl', dest='sslfile', help='certfile[,keyfile] if server listen in ssl mode') |
162 | 162 | parser.add_argument('--pac', dest='pac', help='http PAC path') |
@@ -193,15 +193,15 @@ def main(): |
193 | 193 | servers = [] |
194 | 194 | for option in args.listen: |
195 | 195 | print('Serving on', option.bind, 'by', ",".join(i.name for i in option.protos) + ('(SSL)' if option.sslclient else ''), '({}{})'.format(option.cipher.name, ' '+','.join(i.name() for i in option.cipher.plugins) if option.cipher and option.cipher.plugins else '') if option.cipher else '') |
196 | | - handler = functools.partial(functools.partial(proxy_handler, **vars(args)), **vars(option)) |
| 196 | + handler = functools.partial(proxy_handler, **vars(args), **vars(option)) |
197 | 197 | try: |
198 | 198 | server = loop.run_until_complete(option.server(handler)) |
199 | 199 | servers.append(server) |
200 | 200 | except Exception as ex: |
201 | 201 | print('Start server failed.\n\t==>', ex) |
202 | 202 | if servers: |
203 | | - if args.alive > 0 and args.rserver: |
204 | | - asyncio.ensure_future(check_server_alive(args.alive, args.rserver, args.verbose if args.v else DUMMY)) |
| 203 | + if args.alived > 0 and args.rserver: |
| 204 | + asyncio.ensure_future(check_server_alive(args.alived, args.rserver, args.verbose if args.v else DUMMY)) |
205 | 205 | try: |
206 | 206 | loop.run_forever() |
207 | 207 | except KeyboardInterrupt: |
|
0 commit comments