mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +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"]
|
ip = self.serverdata["ip"]
|
||||||
port = self.serverdata["port"]
|
port = self.serverdata["port"]
|
||||||
try:
|
try:
|
||||||
# Set the socket type (IPv6 or IPv4).
|
# Set the socket type (IPv6 or IPv4), auto detecting it if not specified.
|
||||||
stype = socket.AF_INET6 if self.serverdata.get("ipv6") else socket.AF_INET
|
isipv6 = self.serverdata.get("ipv6", utils.get_hostname_type(ip) == 2)
|
||||||
|
stype = socket.AF_INET6 if isipv6 else socket.AF_INET
|
||||||
|
|
||||||
# Creat the socket.
|
# Creat the socket.
|
||||||
self._socket = socket.socket(stype)
|
self._socket = socket.socket(stype)
|
||||||
|
@ -243,8 +243,10 @@ servers:
|
|||||||
|
|
||||||
# Determines whether IPv6 should be used for this connection. Should the ip:
|
# 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
|
# 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.
|
# (IPv4) or AAAA records (IPv6) will be used in resolving it.
|
||||||
ipv6: yes
|
# 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
|
# 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.
|
# these two fields to "*" and enable SSL with a cert and key file.
|
||||||
|
Loading…
Reference in New Issue
Block a user