3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-28 13:42:37 +01:00

Irc: resolve hostnames when connecting

Cloeses #158.
This commit is contained in:
James Lu 2016-06-11 11:29:11 -07:00
parent cb30aca750
commit b1a5f864d8
2 changed files with 10 additions and 2 deletions

View File

@ -184,6 +184,11 @@ class Irc():
# intentional.
self.socket.settimeout(self.pingfreq)
# Resolve hostnames if it's not an IP address already.
old_ip = ip
ip = socket.getaddrinfo(ip, port, stype)[0][-1][0]
log.debug('(%s) Resolving address %s to %s', self.name, old_ip, ip)
# Enable SSL if set to do so. This requires a valid keyfile and
# certfile to be present.
self.ssl = self.serverdata.get('ssl')

View File

@ -44,7 +44,8 @@ servers:
# You should change this to some abbreviation representing your network
# name; usually something 3-5 characters should be good.
inspnet:
# Server IP, port, and passwords
# Server IP, port, and passwords. The ip: field also supports resolving
# hostnames, but this is not well tested and thus not recommended.
ip: 127.0.0.1
port: 7000
recvpass: "abcd"
@ -121,7 +122,9 @@ servers:
ts6net:
ip: ::1
# Determines whether IPv6 should be used for this connection.
# Determines whether IPv6 should be used for this connection. Should the ip:
# above be a hostname instead of an IP, this will affect whether A records
# (IPv4) or AAAA records (IPv6) will be used in resolving it.
ipv6: yes
port: 7000