From 03635184ae73b0d6438e09d9eafcd8917643dc46 Mon Sep 17 00:00:00 2001 From: Bandie Canis Date: Tue, 3 Oct 2017 00:05:23 +0200 Subject: [PATCH] Now speaks IPv6, if config contains a ":" in host --- ding_client | 5 ++++- ding_server | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ding_client b/ding_client index 03968ac..9ca917f 100755 --- a/ding_client +++ b/ding_client @@ -63,7 +63,10 @@ def main(): print("Please check your paths in the config file. (Have you forgotten to generate the Certificates?)", sep="", file=sys.stderr) quit(2) - conn = context.wrap_socket(socket.socket()) + if(":" in host): + conn = context.wrap_socket(socket.socket(family=socket.AF_INET6)) + else: + conn = context.wrap_socket(socket.socket(family=socket.AF_INET)) try: diff --git a/ding_server b/ding_server index b358d5a..d6cf1c1 100755 --- a/ding_server +++ b/ding_server @@ -102,7 +102,10 @@ def init(): quit(2) try: - bindsocket = socket.socket() + if(":" in host): + bindsocket = socket.socket(family=socket.AF_INET6) + else: + bindsocket = socket.socket(family=socket.AF_INET) bindsocket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) bindsocket.bind((host, port)) bindsocket.listen(5)