Skip to content

Commit

Permalink
Merge pull request #59 from Breina/feature/support-ipv6
Browse files Browse the repository at this point in the history
Add IPv6 support
  • Loading branch information
andreikop authored Mar 18, 2024
2 parents 0e6634f + aec879c commit c31baa7
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 77 deletions.
2 changes: 1 addition & 1 deletion wsdiscovery/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class Discovery:
"networking-agnostic generic remote service discovery mixin"
"""networking-agnostic generic remote service discovery mixin"""

def __init__(self, **kwargs):
self._remoteServices = {}
Expand Down
8 changes: 5 additions & 3 deletions wsdiscovery/service.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Discoverable WS-Discovery service."""
import socket

from .util import _getNetworkAddrs

Expand Down Expand Up @@ -38,10 +39,11 @@ def getXAddrs(self):
for xAddr in self._xAddrs:
if '{ip}' in xAddr:
if ipAddrs is None:
ipAddrs = _getNetworkAddrs()
ipAddrs = _getNetworkAddrs(socket.AF_INET)
ipAddrs.append(_getNetworkAddrs(socket.AF_INET6))
for ipAddr in ipAddrs:
if ipAddr != '127.0.0.1':
ret.append(xAddr.format(ip=ipAddr))
if not ipAddr.is_loopback:
ret.append(xAddr.format(ip=str(ipAddr)))
else:
ret.append(xAddr)
return ret
Expand Down
Loading

0 comments on commit c31baa7

Please sign in to comment.