3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

IRCNetwork: also detect address types from supplied bindhosts

This commit is contained in:
James Lu 2018-06-15 18:43:00 -07:00
parent 26361c4cc9
commit 5e1cb232b0
2 changed files with 9 additions and 2 deletions

View File

@ -1675,6 +1675,11 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
try: try:
# Set the socket type (IPv6 or IPv4), auto detecting it if not specified. # Set the socket type (IPv6 or IPv4), auto detecting it if not specified.
isipv6 = self.serverdata.get("ipv6", utils.get_hostname_type(ip) == 2) 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 stype = socket.AF_INET6 if isipv6 else socket.AF_INET
# Creat the socket. # Creat the socket.

View File

@ -294,9 +294,11 @@ servers:
ip: somenet.ddns.local ip: somenet.ddns.local
port: 45454 port: 45454
# When the IP field is set to a hostname, this option determines whether IPv4 or IPv6 should # When the IP field is set to a hostname, the "ipv6" option determines whether IPv4 or IPv6
# be used for the connection. # 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 #ipv6: false
#bindhost: 1111:2222:3333:4444
# Note: if you are actually using dynamic DNS for an IRC link, consider enabling # 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 # TLS/SSL certificate checking (new in 2.0). These checks are disabled by default for