mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-27 04:59:24 +01:00
core: automatically detect between IPv4 / IPv6 addresses on connect
Closes #212.
This commit is contained in:
parent
5ea33baa8e
commit
d3125d9a8f
@ -1660,8 +1660,9 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
|
||||
ip = self.serverdata["ip"]
|
||||
port = self.serverdata["port"]
|
||||
try:
|
||||
# Set the socket type (IPv6 or IPv4).
|
||||
stype = socket.AF_INET6 if self.serverdata.get("ipv6") else socket.AF_INET
|
||||
# Set the socket type (IPv6 or IPv4), auto detecting it if not specified.
|
||||
isipv6 = self.serverdata.get("ipv6", utils.get_hostname_type(ip) == 2)
|
||||
stype = socket.AF_INET6 if isipv6 else socket.AF_INET
|
||||
|
||||
# Creat the socket.
|
||||
self._socket = socket.socket(stype)
|
||||
|
@ -243,8 +243,10 @@ servers:
|
||||
|
||||
# Determines whether IPv6 should be used for this connection. Should the ip:
|
||||
# above be a hostname instead of an IP, this will also affect whether A records
|
||||
# (no IPv6) or AAAA records (IPv6) will be used in resolving it.
|
||||
ipv6: yes
|
||||
# (IPv4) or AAAA records (IPv6) will be used in resolving it.
|
||||
# As of PyLink 2.0-alpha4, you can leave this unset for direct connections to IP addresses;
|
||||
# the address type will be automatically detected.
|
||||
#ipv6: yes
|
||||
|
||||
# Received and sent passwords. For passwordless links using SSL fingerprints, simply set
|
||||
# these two fields to "*" and enable SSL with a cert and key file.
|
||||
|
Loading…
Reference in New Issue
Block a user