diff --git a/chinadns/dnsrelay.py b/chinadns/dnsrelay.py index ffeb719..26410ea 100644 --- a/chinadns/dnsrelay.py +++ b/chinadns/dnsrelay.py @@ -29,14 +29,15 @@ import struct import logging +import argparse +from shadowsocks import eventloop, asyncdns, lru_cache, common + info = sys.version_info + if not (info[0] == 2 and info[1] >= 7): print 'Python 2.7 required' sys.exit(1) -import argparse -from shadowsocks import eventloop, asyncdns, lru_cache - BUF_SIZE = 16384 @@ -92,7 +93,7 @@ def _parse_hosts(self): parts = line.split() if len(parts) >= 2: ip = parts[0] - if asyncdns.is_ip(ip): + if common.is_ip(ip): for i in xrange(1, len(parts)): hostname = parts[i] if hostname: diff --git a/test.py b/test.py index ae12d00..f0a3175 100755 --- a/test.py +++ b/test.py @@ -2,12 +2,14 @@ # -*- coding: utf-8 -*- import sys -sys.path.insert(0, 'shadowsocks') import os import signal import select + from subprocess import Popen, PIPE +sys.path.insert(0, 'shadowsocks') + with open(sys.argv[-1]) as f: dig_cmd = f.read() p1 = Popen(['sudo', sys.executable, 'chinadns/dnsrelay.py'], shell=False,