Enclose IPv6 address in square brackets

This commit is contained in:
Odd Stråbø 2019-10-03 01:45:31 +02:00
parent e92d60f7c7
commit 578d51bc54
2 changed files with 8 additions and 0 deletions

View file

@ -4,6 +4,7 @@
import logging
import os
import ipaddress
import xbmcgui
import xbmcaddon
@ -115,6 +116,12 @@ class ServerManual(xbmcgui.WindowXMLDialog):
return control
def _connect_to_server(self, server, port):
try:
addr = ipaddress.ip_address(server.decode('utf-8') if not isinstance(server, type(u'')) else server)
if addr.version == 6:
server = u"[%s]" % (addr.compressed)
except ValueError:
pass
server_address = "%s:%s" % (server, port) if port else server
self._message("%s %s..." % (_(30610), server_address))

View file

@ -453,6 +453,7 @@ class ConnectionManager(object):
else:
return servers
# TODO: Make IPv6 compatable
def _convert_endpoint_address_to_manual_address(self, info):
if info.get('Address') and info.get('EndpointAddress'):