From 5a61d8f78257424cb9e84bc3f8599d3ea7950d3d Mon Sep 17 00:00:00 2001 From: Flowseal Date: Fri, 18 Sep 2026 17:30:35 +0300 Subject: [PATCH] Simplify passing None to --dc-ip --- proxy/tg_ws_proxy.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/proxy/tg_ws_proxy.py b/proxy/tg_ws_proxy.py index e77acbb..fb54db6 100644 --- a/proxy/tg_ws_proxy.py +++ b/proxy/tg_ws_proxy.py @@ -647,7 +647,7 @@ def main(): ap.add_argument('--secret', type=str, default=None, help='MTProto proxy secret (32 hex chars). ' 'Auto-generated if not provided.') - ap.add_argument('--dc-ip', metavar='DC:IP', action='append', + ap.add_argument('--dc-ip', metavar='DC:IP', nargs='?', action='append', const=None, help='Target IP for a DC, e.g. --dc-ip 2:149.154.167.220') ap.add_argument('-v', '--verbose', action='store_true', help='Debug logging') @@ -687,8 +687,13 @@ def main(): '(for use behind nginx/haproxy with proxy_protocol on)') args = ap.parse_args() - if not args.dc_ip: - args.dc_ip = ['2:149.154.167.220', '4:149.154.167.220'] + if args.dc_ip is None: + args.dc_ip = [ + '2:149.154.167.220', + '4:149.154.167.220', + ] + elif None in args.dc_ip: + args.dc_ip = [] try: dc_redirects = parse_dc_ip_list(args.dc_ip)