From 6823117c632bcdd0055c134f527b5767aed14125 Mon Sep 17 00:00:00 2001 From: pouryare Date: Thu, 27 Jun 2019 06:23:45 +0430 Subject: [PATCH] Update mtprotoproxy.py --- mtprotoproxy.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mtprotoproxy.py b/mtprotoproxy.py index f2a9437..bc4b58e 100755 --- a/mtprotoproxy.py +++ b/mtprotoproxy.py @@ -48,8 +48,8 @@ SECURE_ONLY = config.get("SECURE_ONLY", False) # one client can create many tcp connections, up to 8 USER_MAX_TCP_CONNS = config.get("USER_MAX_TCP_CONNS", {}) -# expiration -USER_EXPIRARION = config.get("USER_EXPIRARION", {}) +# expiration date for users in format of day/month/year +USER_EXPIRATION = config.get("USER_EXPIRATION", {}) # length of used handshake randoms for active fingerprinting protection REPLAY_CHECK_LEN = config.get("REPLAY_CHECK_LEN", 32768) @@ -1064,7 +1064,7 @@ async def handle_client(reader_clt, writer_clt): task_clt_to_tg = asyncio.ensure_future(clt_to_tg) update_stats(user, curr_connects=1) - if ((user not in USER_MAX_TCP_CONNS or stats[user]["curr_connects"] <= USER_MAX_TCP_CONNS[user]) and (user not in USER_EXPIRARION or datetime.datetime.now() <= datetime.datetime.strptime(USER_EXPIRARION[user],"%d/%m/%Y"))): + if ((user not in USER_MAX_TCP_CONNS or stats[user]["curr_connects"] <= USER_MAX_TCP_CONNS[user]) and (user not in USER_EXPIRATION or datetime.datetime.now() <= datetime.datetime.strptime(USER_EXPIRARION[user],"%d/%m/%Y"))): await asyncio.wait([task_tg_to_clt, task_clt_to_tg], return_when=asyncio.FIRST_COMPLETED) update_stats(user, curr_connects=-1)