From 949f9b4404004c35bfa43be29667538d3e214ed0 Mon Sep 17 00:00:00 2001 From: KF7EEL Date: Sun, 30 May 2021 19:36:23 -0700 Subject: [PATCH] add ability for 3 different proxies --- full_bridge.py | 22 +++++++++++++--------- sms_aprs_config.py | 3 +++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/full_bridge.py b/full_bridge.py index 14f1188..16c3975 100644 --- a/full_bridge.py +++ b/full_bridge.py @@ -2992,18 +2992,22 @@ if __name__ == '__main__': aprs_thread.start() # Create file for static positions - by IU7IGU ## open("nom_aprs","w").close + if CONFIG['PROXY_A']['ENABLED']: - proxy_thread = threading.Thread(target=hotspot_proxy, args=(CONFIG['PROXY_A']['EXTERNAL_PORT'],CONFIG['PROXY_A']['INTERNAL_PORT_START'],CONFIG['PROXY_A']['INTERNAL_PORT_STOP'],)) - proxy_thread.daemon = True - proxy_thread.start() + if not CONFIG['PROXY_A']['USE_EXTERNAL_PROXY']: + proxy_thread = threading.Thread(target=hotspot_proxy, args=(CONFIG['PROXY_A']['EXTERNAL_PORT'],CONFIG['PROXY_A']['INTERNAL_PORT_START'],CONFIG['PROXY_A']['INTERNAL_PORT_STOP'],)) + proxy_thread.daemon = True + proxy_thread.start() if CONFIG['PROXY_B']['ENABLED']: - proxy_thread = threading.Thread(target=hotspot_proxy, args=(CONFIG['PROXY_B']['EXTERNAL_PORT'],CONFIG['PROXY_B']['INTERNAL_PORT_START'],CONFIG['PROXY_B']['INTERNAL_PORT_STOP'],)) - proxy_thread.daemon = True - proxy_thread.start() + if not CONFIG['PROXY_B']['USE_EXTERNAL_PROXY']: + proxy_thread = threading.Thread(target=hotspot_proxy, args=(CONFIG['PROXY_B']['EXTERNAL_PORT'],CONFIG['PROXY_B']['INTERNAL_PORT_START'],CONFIG['PROXY_B']['INTERNAL_PORT_STOP'],)) + proxy_thread.daemon = True + proxy_thread.start() if CONFIG['PROXY_C']['ENABLED']: - proxy_thread = threading.Thread(target=hotspot_proxy, args=(CONFIG['PROXY_C']['EXTERNAL_PORT'],CONFIG['PROXY_C']['INTERNAL_PORT_START'],CONFIG['PROXY_C']['INTERNAL_PORT_STOP'],)) - proxy_thread.daemon = True - proxy_thread.start() + if not CONFIG['PROXY_C']['USE_EXTERNAL_PROXY']: + proxy_thread = threading.Thread(target=hotspot_proxy, args=(CONFIG['PROXY_C']['EXTERNAL_PORT'],CONFIG['PROXY_C']['INTERNAL_PORT_START'],CONFIG['PROXY_C']['INTERNAL_PORT_STOP'],)) + proxy_thread.daemon = True + proxy_thread.start() logger.info('Unit calls will be bridged to: ' + str(UNIT)) reactor.run() diff --git a/sms_aprs_config.py b/sms_aprs_config.py index c0aca30..61dd9ac 100755 --- a/sms_aprs_config.py +++ b/sms_aprs_config.py @@ -204,6 +204,7 @@ def build_config(_config_file): elif section == 'PROXY_A': CONFIG['PROXY_A'].update({ 'ENABLED': config.getboolean(section, 'ENABLED'), + 'USE_EXTERNAL_PROXY': config.getboolean(section, 'USE_EXTERNAL_PROXY'), 'NAME': config.get(section, 'NAME'), 'REPEAT': config.getboolean(section, 'REPEAT'), 'EXTERNAL_PORT': config.getint(section, 'EXTERNAL_PORT'), @@ -221,6 +222,7 @@ def build_config(_config_file): elif section == 'PROXY_B': CONFIG['PROXY_B'].update({ 'ENABLED': config.getboolean(section, 'ENABLED'), + 'USE_EXTERNAL_PROXY': config.getboolean(section, 'USE_EXTERNAL_PROXY'), 'NAME': config.get(section, 'NAME'), 'REPEAT': config.getboolean(section, 'REPEAT'), 'EXTERNAL_PORT': config.getint(section, 'EXTERNAL_PORT'), @@ -238,6 +240,7 @@ def build_config(_config_file): elif section == 'PROXY_C': CONFIG['PROXY_C'].update({ 'ENABLED': config.getboolean(section, 'ENABLED'), + 'USE_EXTERNAL_PROXY': config.getboolean(section, 'USE_EXTERNAL_PROXY'), 'NAME': config.get(section, 'NAME'), 'REPEAT': config.getboolean(section, 'REPEAT'), 'EXTERNAL_PORT': config.getint(section, 'EXTERNAL_PORT'),