From 19969a02b2ea7d24016a49f85b607bae1ab12177 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Tue, 10 May 2022 13:24:32 +0200 Subject: [PATCH] chg: [websockets client] bind client ip --- bin/core/ail_2_ail_client.py | 9 +++++++++ configs/core.cfg.sample | 1 + 2 files changed, 10 insertions(+) diff --git a/bin/core/ail_2_ail_client.py b/bin/core/ail_2_ail_client.py index 810f93c6..29e6c37f 100755 --- a/bin/core/ail_2_ail_client.py +++ b/bin/core/ail_2_ail_client.py @@ -20,6 +20,14 @@ sys.path.append(os.environ['AIL_BIN']) # Import Project packages ################################## from core import ail_2_ail +from lib.ConfigLoader import ConfigLoader + +config_loader = ConfigLoader() +local_addr = config_loader.get_config_str('AIL_2_AIL', 'local_addr') +if not local_addr or local_addr == None: + local_addr = None +config_loader = None + #### LOGS #### redis_logger = publisher @@ -112,6 +120,7 @@ async def ail_to_ail_client(ail_uuid, sync_mode, api, ail_key=None, client_id=No async with websockets.connect( uri, ssl=ssl_context, + local_addr=local_addr, #open_timeout=10, websockers 10.0 /!\ python>=3.7 extra_headers={"Authorization": f"{ail_key}"} ) as websocket: diff --git a/configs/core.cfg.sample b/configs/core.cfg.sample index e0100533..0a04268f 100644 --- a/configs/core.cfg.sample +++ b/configs/core.cfg.sample @@ -60,6 +60,7 @@ DiffMaxLineLength = 10000 [AIL_2_AIL] server_host = 0.0.0.0 server_port = 4443 +local_addr = #### Modules #### [BankAccount]