From 5e1cb232b0e318e167e10c9375bd1c33179a76a4 Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 15 Jun 2018 18:43:00 -0700 Subject: [PATCH] IRCNetwork: also detect address types from supplied bindhosts --- classes.py | 5 +++++ example-conf.yml | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/classes.py b/classes.py index e3348b6..634032e 100644 --- a/classes.py +++ b/classes.py @@ -1675,6 +1675,11 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils): try: # Set the socket type (IPv6 or IPv4), auto detecting it if not specified. isipv6 = self.serverdata.get("ipv6", utils.get_hostname_type(ip) == 2) + + if (not isipv6) and 'bindhost' in self.serverdata: + # Also try detecting the socket type from the bindhost if specified. + isipv6 = utils.get_hostname_type(self.serverdata['bindhost']) == 2 + stype = socket.AF_INET6 if isipv6 else socket.AF_INET # Creat the socket. diff --git a/example-conf.yml b/example-conf.yml index 2821e31..26de96c 100644 --- a/example-conf.yml +++ b/example-conf.yml @@ -294,9 +294,11 @@ servers: ip: somenet.ddns.local port: 45454 - # When the IP field is set to a hostname, this option determines whether IPv4 or IPv6 should - # be used for the connection. + # When the IP field is set to a hostname, the "ipv6" option determines whether IPv4 or IPv6 + # addresses should be used when resolving it. You can leave this field blank and use an + # explicit bindhost instead, which will let the the address type be automatically detected. #ipv6: false + #bindhost: 1111:2222:3333:4444 # Note: if you are actually using dynamic DNS for an IRC link, consider enabling # TLS/SSL certificate checking (new in 2.0). These checks are disabled by default for