From 497fa3143aab358600fb919a569162464d9859ff Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 6 Jul 2021 01:12:19 +0100 Subject: [PATCH] Make preference for IPv6 when IP: :: more explicit for OBP --- config.py | 5 ++++- docker-configs/Dockerfile-hbmonv2 | 2 +- docker-configs/docker-compose.yml | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index 90c8550..1a6d2c7 100755 --- a/config.py +++ b/config.py @@ -333,7 +333,10 @@ def build_config(_config_file): try: if CONFIG['SYSTEMS'][section]['IP'] == '::': - addr_info = socket.getaddrinfo(CONFIG['SYSTEMS'][section]['TARGET_IP'],CONFIG['SYSTEMS'][section]['TARGET_PORT'],socket.AF_UNSPEC, socket.IPPROTO_IP) + try: + addr_info = socket.getaddrinfo(CONFIG['SYSTEMS'][section]['TARGET_IP'],CONFIG['SYSTEMS'][section]['TARGET_PORT'],socket.AF_INET6, socket.IPPROTO_IP) + except gaierror: + addr_info = socket.getaddrinfo(CONFIG['SYSTEMS'][section]['TARGET_IP'],CONFIG['SYSTEMS'][section]['TARGET_PORT'],socket.AF_INET, socket.IPPROTO_IP) elif CONFIG['SYSTEMS'][section]['IP'] and IsIPv6Address(CONFIG['SYSTEMS'][section]['IP']): addr_info = socket.getaddrinfo(CONFIG['SYSTEMS'][section]['TARGET_IP'],CONFIG['SYSTEMS'][section]['TARGET_PORT'],socket.AF_INET6, socket.IPPROTO_IP) diff --git a/docker-configs/Dockerfile-hbmonv2 b/docker-configs/Dockerfile-hbmonv2 index 65228b0..b8a5393 100644 --- a/docker-configs/Dockerfile-hbmonv2 +++ b/docker-configs/Dockerfile-hbmonv2 @@ -1,4 +1,4 @@ -FROM python:3.7-alpine +aplFROM python:3.7-alpine COPY entrypoint-proxy /entrypoint diff --git a/docker-configs/docker-compose.yml b/docker-configs/docker-compose.yml index f0f4dcd..7b414d3 100644 --- a/docker-configs/docker-compose.yml +++ b/docker-configs/docker-compose.yml @@ -11,3 +11,4 @@ services: - '62045-62049:62045-62049/udp' - '4321:4321/tcp' image: 'hacknix/freedmr:latest' + restart: "unless-stopped"