From 39df7f1995203929abe06638d324b2d7dd786f1a Mon Sep 17 00:00:00 2001 From: ghost Date: Tue, 26 Dec 2023 19:01:26 +0200 Subject: [PATCH] add IPv6 support --- pymaster.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pymaster.py b/pymaster.py index aef70da..005a1bb 100755 --- a/pymaster.py +++ b/pymaster.py @@ -19,7 +19,10 @@ MAX_SERVERS_FOR_IP = 14 class PyMaster: def __init__(self, ip, port): self.serverList = [] - self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + if ':' in ip: + self.sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) + else: + self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.sock.bind((ip, port)) logging.debug("Welcome to PyMaster!")