Skip to content

Commit

Permalink
support IPv6 on control socket
Browse files Browse the repository at this point in the history
  • Loading branch information
clowwindy committed Aug 6, 2015
1 parent 583b54f commit 3576b30
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions shadowsocks/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ def __init__(self, config):
try:
manager_address = config['manager_address']
if ':' in manager_address:
addr = manager_address.split(':')
addr = manager_address.rsplit(':', 1)
addr = addr[0], int(addr[1])
family = socket.AF_INET
addrs = socket.getaddrinfo(addr[0], addr[1])
if addrs:
family = addrs[0][0]
else:
logging.error('invalid address: %s', manager_address)
exit(1)
else:
addr = manager_address
family = socket.AF_UNIX
# TODO use address instead of port
self._control_socket = socket.socket(family,
socket.SOCK_DGRAM)
self._control_socket.bind(addr)
Expand Down

0 comments on commit 3576b30

Please sign in to comment.