Skip to content

Commit

Permalink
refine dns resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed Jul 30, 2015
1 parent 092d880 commit c2c7cab
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 17 deletions.
26 changes: 14 additions & 12 deletions gfwlist/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@

def main():
china_list_set = IPy.IPSet()
for line in sys.stdin:
line_params = line.split("|")
if len(line_params) < 5 or line_params[2] != "ipv4" or line_params[1] != "CN":
continue
ip_addr = line_params[3]
ip_length = float(line_params[4])
ip_mask = 32 - int(math.ceil(math.log(ip_length, 2)))
china_list_set.add(IPy.IP("%s/%d" % (ip_addr, ip_mask)))
# for line in sys.stdin:
# line_params = line.split("|")
# if len(line_params) < 5 or line_params[2] != "ipv4" or line_params[1] != "CN":
# continue
# ip_addr = line_params[3]
# ip_length = float(line_params[4])
# ip_mask = 32 - int(math.ceil(math.log(ip_length, 2)))
# china_list_set.add(IPy.IP("%s/%d" % (ip_addr, ip_mask)))

# 添加内网地址
internal_list = IPy.IPSet(map(IPy.IP, [
"0.0.0.0/8",
"10.0.0.0/8",
"100.64.0.0/10",
"114.114.114.0/24",
"127.0.0.0/8",
"169.254.0.0/16",
"172.16.0.0/12",
Expand All @@ -34,6 +35,7 @@ def main():
"198.18.0.0/15",
"198.51.100.0/24",
"203.0.113.0/24",
"223.5.5.0/24",
"224.0.0.0/4",
"240.0.0.0/4",
]))
Expand All @@ -45,10 +47,10 @@ def main():
for ip in china_list_set:
all.discard(ip)

filter = itertools.ifilter(lambda x: len(x) <= 65536, all)
for ip in filter:
all.discard(ip)
all.add(IPy.IP(ip.strNormal(0)).make_net('255.255.0.0'))
# filter = itertools.ifilter(lambda x: len(x) <= 65536, all)
# for ip in filter:
# all.discard(ip)
# all.add(IPy.IP(ip.strNormal(0)).make_net('255.255.0.0'))

# 输出结果
for ip in all:
Expand Down
4 changes: 2 additions & 2 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.shadowsocks"
android:versionCode="111"
android:versionName="2.7.3">
android:versionCode="112"
android:versionName="2.7.4">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Expand Down
2 changes: 1 addition & 1 deletion src/main/jni/shadowsocks-libev
41 changes: 39 additions & 2 deletions src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,25 @@
<item>101.0.0.0/8</item>
<item>102.0.0.0/7</item>
<item>104.0.0.0/5</item>
<item>112.0.0.0/5</item>
<item>112.0.0.0/7</item>
<item>114.0.0.0/10</item>
<item>114.64.0.0/11</item>
<item>114.96.0.0/12</item>
<item>114.112.0.0/15</item>
<item>114.114.0.0/18</item>
<item>114.114.64.0/19</item>
<item>114.114.96.0/20</item>
<item>114.114.112.0/23</item>
<item>114.114.115.0/24</item>
<item>114.114.116.0/22</item>
<item>114.114.120.0/21</item>
<item>114.114.128.0/17</item>
<item>114.115.0.0/16</item>
<item>114.116.0.0/14</item>
<item>114.120.0.0/13</item>
<item>114.128.0.0/9</item>
<item>115.0.0.0/8</item>
<item>116.0.0.0/6</item>
<item>120.0.0.0/6</item>
<item>124.0.0.0/7</item>
<item>126.0.0.0/8</item>
Expand Down Expand Up @@ -190,6 +208,25 @@
<item>203.64.0.0/10</item>
<item>203.128.0.0/9</item>
<item>204.0.0.0/6</item>
<item>208.0.0.0/4</item>
<item>208.0.0.0/5</item>
<item>216.0.0.0/6</item>
<item>220.0.0.0/7</item>
<item>222.0.0.0/8</item>
<item>223.0.0.0/14</item>
<item>223.4.0.0/16</item>
<item>223.5.0.0/22</item>
<item>223.5.4.0/24</item>
<item>223.5.6.0/23</item>
<item>223.5.8.0/21</item>
<item>223.5.16.0/20</item>
<item>223.5.32.0/19</item>
<item>223.5.64.0/18</item>
<item>223.5.128.0/17</item>
<item>223.6.0.0/15</item>
<item>223.8.0.0/13</item>
<item>223.16.0.0/12</item>
<item>223.32.0.0/11</item>
<item>223.64.0.0/10</item>
<item>223.128.0.0/9</item>
</string-array>
</resources>

0 comments on commit c2c7cab

Please sign in to comment.