From d5449961f33f1f14a2f5d9ddb8d7161a76be06c7 Mon Sep 17 00:00:00 2001 From: Brian Martin Date: Wed, 20 Mar 2019 08:05:02 -0400 Subject: [PATCH] Add --listen arg A system with multiple nics had an issue with selecting the right IP to listen on. Add --listen command-line arg. Usage: run_bumper.py --listen ip.address --- start_bumper.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/start_bumper.py b/start_bumper.py index db35ee3..1975e80 100644 --- a/start_bumper.py +++ b/start_bumper.py @@ -22,12 +22,16 @@ def main(): format="[%(asctime)s] :: %(levelname)s :: %(name)s :: %(message)s", ) # format="[%(asctime)s] :: %(levelname)s :: %(name)s :: %(module)s :: %(funcName)s :: %(lineno)d :: %(message)s") - - if platform.system() == "Darwin": # If a Mac, use 0.0.0.0 for listening - listen_host = "0.0.0.0" - else: - listen_host = socket.gethostbyname(socket.gethostname()) - #listen_host = "localhost" # Try this if the above doesn't work + + listen_host = args.index("--listen") + if (len(args) - 1) >= (listen_host + 1): + listen_host = args[listen_host+1] + else: + if platform.system() == "Darwin": # If a Mac, use 0.0.0.0 for listening + listen_host = "0.0.0.0" + else: + listen_host = socket.gethostbyname(socket.gethostname()) + #listen_host = "localhost" # Try this if the above doesn't work conf_address_443 = (listen_host, 443)