This commit is contained in:
clowwindy 2014-09-14 10:06:16 +08:00
parent ebf5baa311
commit 3ce7c18dfb
2 changed files with 7 additions and 2 deletions

View File

@ -6,7 +6,7 @@ with open('README.rst') as f:
setup(
name="shadowsocks",
version="2.2.1",
version="2.2.2",
license='MIT',
description="A fast tunnel proxy that help you get through firewalls",
author='clowwindy',

View File

@ -218,6 +218,8 @@ def parse_response(data):
response = DNSResponse()
if qds:
response.hostname = qds[0][0]
for an in qds:
response.questions.append((an[1], an[2], an[3]))
for an in ans:
response.answers.append((an[1], an[2], an[3]))
return response
@ -249,6 +251,7 @@ def is_valid_hostname(hostname):
class DNSResponse(object):
def __init__(self):
self.hostname = None
self.questions = [] # each: (addr, type, class)
self.answers = [] # each: (addr, type, class)
def __str__(self):
@ -358,7 +361,9 @@ class DNSResolver(object):
else:
if ip:
self._cache[hostname] = ip
self._call_callback(hostname, ip)
self._call_callback(hostname, ip)
elif self._hostname_status.get(hostname, None) == STATUS_IPV6:
self._call_callback(hostname, None)
def handle_events(self, events):
for sock, fd, event in events: