diff --git a/setup.py b/setup.py index dd1ca21..8d12440 100644 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/shadowsocks/asyncdns.py b/shadowsocks/asyncdns.py index d74d5e8..a103f8c 100644 --- a/shadowsocks/asyncdns.py +++ b/shadowsocks/asyncdns.py @@ -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: