clowwindy 10 years ago
parent
commit
3ce7c18dfb
  1. 2
      setup.py
  2. 5
      shadowsocks/asyncdns.py

2
setup.py

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

5
shadowsocks/asyncdns.py

@ -218,6 +218,8 @@ def parse_response(data):
response = DNSResponse() response = DNSResponse()
if qds: if qds:
response.hostname = qds[0][0] response.hostname = qds[0][0]
for an in qds:
response.questions.append((an[1], an[2], an[3]))
for an in ans: for an in ans:
response.answers.append((an[1], an[2], an[3])) response.answers.append((an[1], an[2], an[3]))
return response return response
@ -249,6 +251,7 @@ def is_valid_hostname(hostname):
class DNSResponse(object): class DNSResponse(object):
def __init__(self): def __init__(self):
self.hostname = None self.hostname = None
self.questions = [] # each: (addr, type, class)
self.answers = [] # each: (addr, type, class) self.answers = [] # each: (addr, type, class)
def __str__(self): def __str__(self):
@ -359,6 +362,8 @@ class DNSResolver(object):
if ip: if ip:
self._cache[hostname] = 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): def handle_events(self, events):
for sock, fd, event in events: for sock, fd, event in events:

Loading…
Cancel
Save