Skip to content

compatible to newer shadowsocks version #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions chinadns/dnsrelay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down