Skip to content

Commit

Permalink
Merge pull request Anorov#40 from tmelhiser/master
Browse files Browse the repository at this point in the history
RDNS and Resolve Local fixes
  • Loading branch information
Anorov committed Mar 24, 2016
2 parents 3d0b3e0 + d36260b commit 6691185
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions socks.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def _write_SOCKS5_address(self, addr, file):
file.write(b"\x03" + chr(len(host_bytes)).encode() + host_bytes)
else:
# Resolve locally
addresses = socket.getaddrinfo(host, port)
addresses = socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM, socket.IPPROTO_TCP, socket.AI_ADDRCONFIG)
# We can't really work out what IP is reachable, so just pick the
# first.
target_addr = addresses[0]
Expand All @@ -539,8 +539,8 @@ def _write_SOCKS5_address(self, addr, file):
addr_bytes = socket.inet_pton(family, host)
file.write(family_to_byte[family] + addr_bytes)
host = socket.inet_ntop(family, addr_bytes)
file.write(struct.pack(">H", port))
return host, port
file.write(struct.pack(">H", port))
return host, port

def _read_SOCKS5_address(self, file):
atyp = self._readall(file, 1)
Expand Down

0 comments on commit 6691185

Please sign in to comment.