diff --git a/gfwlist/gen.py b/gfwlist/gen.py index bac11221..cd172b6a 100644 --- a/gfwlist/gen.py +++ b/gfwlist/gen.py @@ -10,14 +10,14 @@ import IPy 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, [ @@ -41,11 +41,13 @@ def main(): ])) china_list_set += internal_list + all = china_list_set + # 取反 - all = IPy.IPSet([IPy.IP("0.0.0.0/0")]) + # all = IPy.IPSet([IPy.IP("0.0.0.0/0")]) # 剔除所有孤立的C段 - for ip in china_list_set: - all.discard(ip) + # for ip in china_list_set: + # all.discard(ip) # filter = itertools.ifilter(lambda x: len(x) <= 65536, all) # for ip in filter: diff --git a/src/main/res/values/chnroute.xml b/src/main/res/values/chnroute.xml index c86525d5..207aa2d9 100644 --- a/src/main/res/values/chnroute.xml +++ b/src/main/res/values/chnroute.xml @@ -321,6 +321,10 @@ 43.239.0.0/19 43.239.32.0/20 43.239.48.0/22 + 43.239.116.0/22 + 43.239.120.0/22 + 43.239.172.0/22 + 43.239.176.0/22 43.240.0.0/22 43.240.48.0/22 43.240.56.0/21 @@ -505,6 +509,154 @@ 43.255.232.0/22 43.255.244.0/22 45.64.112.0/23 + 45.112.132.0/22 + 45.112.188.0/22 + 45.112.208.0/20 + 45.112.228.0/22 + 45.112.232.0/21 + 45.113.12.0/22 + 45.113.16.0/20 + 45.113.40.0/22 + 45.113.52.0/22 + 45.113.56.0/22 + 45.113.72.0/22 + 45.113.108.0/22 + 45.113.144.0/21 + 45.113.168.0/22 + 45.113.176.0/22 + 45.113.184.0/22 + 45.113.200.0/21 + 45.113.208.0/20 + 45.113.228.0/22 + 45.113.240.0/22 + 45.113.252.0/22 + 45.114.0.0/22 + 45.114.12.0/22 + 45.114.32.0/22 + 45.114.40.0/22 + 45.114.52.0/22 + 45.114.96.0/22 + 45.114.104.0/22 + 45.114.136.0/22 + 45.114.196.0/22 + 45.114.200.0/22 + 45.114.228.0/22 + 45.114.236.0/22 + 45.114.252.0/22 + 45.115.44.0/22 + 45.115.100.0/22 + 45.115.120.0/22 + 45.115.132.0/22 + 45.115.144.0/22 + 45.115.156.0/22 + 45.115.164.0/22 + 45.115.200.0/22 + 45.115.212.0/22 + 45.115.216.0/22 + 45.115.228.0/22 + 45.115.236.0/22 + 45.115.244.0/22 + 45.115.248.0/22 + 45.116.12.0/22 + 45.116.16.0/21 + 45.116.24.0/22 + 45.116.32.0/21 + 45.116.52.0/22 + 45.116.60.0/22 + 45.116.64.0/22 + 45.116.96.0/21 + 45.116.140.0/22 + 45.116.152.0/22 + 45.116.208.0/22 + 45.117.8.0/22 + 45.117.20.0/22 + 45.117.40.0/22 + 45.117.68.0/22 + 45.117.124.0/22 + 45.117.252.0/22 + 45.119.52.0/22 + 45.119.60.0/22 + 45.119.64.0/21 + 45.119.72.0/22 + 45.119.104.0/22 + 45.119.116.0/22 + 45.119.160.0/22 + 45.119.232.0/22 + 45.120.100.0/22 + 45.120.140.0/22 + 45.120.156.0/22 + 45.120.164.0/22 + 45.120.220.0/22 + 45.120.240.0/22 + 45.121.20.0/22 + 45.121.52.0/22 + 45.121.64.0/21 + 45.121.72.0/22 + 45.121.92.0/22 + 45.121.96.0/22 + 45.121.104.0/22 + 45.121.172.0/22 + 45.121.176.0/22 + 45.121.212.0/22 + 45.121.240.0/20 + 45.122.0.0/19 + 45.122.32.0/21 + 45.122.40.0/22 + 45.122.60.0/22 + 45.122.64.0/19 + 45.122.96.0/20 + 45.122.112.0/21 + 45.122.160.0/19 + 45.122.192.0/20 + 45.122.208.0/21 + 45.122.216.0/22 + 45.123.28.0/22 + 45.123.32.0/21 + 45.123.44.0/22 + 45.123.48.0/20 + 45.123.64.0/20 + 45.123.80.0/21 + 45.123.88.0/22 + 45.123.120.0/22 + 45.123.128.0/21 + 45.123.136.0/22 + 45.123.148.0/22 + 45.123.152.0/21 + 45.123.164.0/22 + 45.123.168.0/21 + 45.123.176.0/21 + 45.123.184.0/22 + 45.123.204.0/22 + 45.123.212.0/22 + 45.123.224.0/19 + 45.124.0.0/22 + 45.124.20.0/22 + 45.124.28.0/22 + 45.124.32.0/21 + 45.124.44.0/22 + 45.124.68.0/22 + 45.124.76.0/22 + 45.124.80.0/22 + 45.124.100.0/22 + 45.124.124.0/22 + 45.124.172.0/22 + 45.124.176.0/22 + 45.124.208.0/22 + 45.124.248.0/21 + 45.125.12.0/22 + 45.125.16.0/22 + 45.125.24.0/21 + 45.125.32.0/22 + 45.125.44.0/22 + 45.125.52.0/22 + 45.125.56.0/22 + 45.125.76.0/22 + 45.125.80.0/20 + 45.125.96.0/21 + 45.125.104.0/22 + 45.125.136.0/22 + 47.92.0.0/14 + 47.96.0.0/11 49.4.0.0/14 49.51.0.0/16 49.52.0.0/14 @@ -803,7 +955,6 @@ 103.30.96.0/22 103.30.148.0/22 103.30.200.0/22 - 103.30.216.0/22 103.30.228.0/22 103.30.236.0/22 103.31.0.0/22 @@ -818,6 +969,8 @@ 103.35.0.0/19 103.35.32.0/20 103.35.48.0/22 + 103.35.104.0/22 + 103.35.116.0/22 103.36.20.0/22 103.36.28.0/22 103.36.36.0/22 @@ -1004,6 +1157,142 @@ 103.50.224.0/20 103.50.240.0/21 103.50.248.0/22 + 103.52.40.0/22 + 103.52.72.0/21 + 103.52.80.0/21 + 103.52.96.0/21 + 103.52.104.0/22 + 103.52.160.0/21 + 103.52.172.0/22 + 103.52.176.0/22 + 103.52.184.0/22 + 103.52.196.0/22 + 103.53.4.0/22 + 103.53.64.0/21 + 103.53.92.0/22 + 103.53.100.0/22 + 103.53.124.0/22 + 103.53.128.0/20 + 103.53.144.0/22 + 103.53.160.0/22 + 103.53.180.0/22 + 103.53.204.0/22 + 103.53.208.0/22 + 103.53.216.0/22 + 103.53.236.0/22 + 103.53.248.0/22 + 103.54.8.0/22 + 103.54.48.0/22 + 103.54.60.0/22 + 103.54.160.0/21 + 103.54.212.0/22 + 103.54.228.0/22 + 103.54.240.0/22 + 103.55.24.0/22 + 103.55.80.0/22 + 103.55.120.0/22 + 103.55.152.0/22 + 103.55.172.0/22 + 103.55.204.0/22 + 103.55.208.0/22 + 103.55.228.0/22 + 103.55.236.0/22 + 103.55.240.0/22 + 103.56.8.0/22 + 103.56.16.0/21 + 103.56.32.0/22 + 103.56.52.0/22 + 103.56.56.0/21 + 103.56.72.0/21 + 103.56.100.0/22 + 103.56.104.0/22 + 103.56.140.0/22 + 103.56.152.0/22 + 103.56.184.0/22 + 103.56.200.0/22 + 103.56.216.0/22 + 103.57.12.0/22 + 103.57.52.0/22 + 103.57.56.0/22 + 103.57.76.0/22 + 103.57.108.0/22 + 103.57.136.0/22 + 103.57.196.0/22 + 103.58.24.0/22 + 103.58.182.0/23 + 103.59.76.0/22 + 103.59.100.0/22 + 103.59.112.0/20 + 103.59.128.0/22 + 103.59.148.0/22 + 103.59.164.0/22 + 103.59.216.0/22 + 103.60.32.0/22 + 103.60.44.0/22 + 103.60.164.0/22 + 103.60.228.0/22 + 103.60.236.0/22 + 103.61.60.0/22 + 103.61.104.0/22 + 103.61.140.0/22 + 103.61.152.0/21 + 103.61.160.0/22 + 103.61.172.0/22 + 103.61.176.0/22 + 103.61.184.0/21 + 103.62.24.0/22 + 103.62.52.0/22 + 103.62.72.0/21 + 103.62.80.0/21 + 103.62.88.0/22 + 103.62.96.0/19 + 103.62.128.0/21 + 103.62.156.0/22 + 103.62.160.0/19 + 103.62.192.0/22 + 103.62.204.0/22 + 103.62.208.0/20 + 103.62.224.0/22 + 103.63.32.0/19 + 103.63.64.0/20 + 103.63.80.0/21 + 103.63.88.0/22 + 103.63.140.0/22 + 103.63.144.0/22 + 103.63.152.0/22 + 103.63.160.0/20 + 103.63.176.0/21 + 103.63.184.0/22 + 103.63.192.0/20 + 103.63.208.0/22 + 103.63.240.0/20 + 103.192.0.0/19 + 103.192.48.0/21 + 103.192.56.0/22 + 103.192.84.0/22 + 103.192.88.0/21 + 103.192.96.0/20 + 103.192.112.0/22 + 103.192.128.0/20 + 103.192.144.0/22 + 103.192.164.0/22 + 103.192.188.0/22 + 103.192.208.0/21 + 103.192.216.0/22 + 103.192.252.0/22 + 103.193.40.0/21 + 103.193.120.0/21 + 103.193.140.0/22 + 103.193.144.0/21 + 103.193.160.0/22 + 103.193.188.0/22 + 103.193.192.0/22 + 103.193.212.0/22 + 103.193.216.0/21 + 103.193.224.0/20 + 103.193.240.0/22 + 103.194.16.0/22 + 103.194.230.0/23 103.224.40.0/21 103.224.60.0/22 103.224.80.0/22 @@ -1096,6 +1385,7 @@ 103.236.0.0/18 103.236.64.0/19 103.236.96.0/22 + 103.236.120.0/22 103.237.0.0/20 103.237.24.0/21 103.237.68.0/22 @@ -1936,6 +2226,7 @@ 166.111.0.0/16 167.139.0.0/16 167.189.0.0/16 + 167.220.244.0/22 168.160.0.0/16 169.254.0.0/16 171.8.0.0/13 @@ -3363,7 +3654,6 @@ 210.26.0.0/15 210.28.0.0/14 210.32.0.0/12 - 210.48.136.0/21 210.51.0.0/16 210.52.0.0/15 210.56.192.0/19 @@ -3481,5 +3771,6 @@ 223.255.0.0/17 223.255.236.0/22 223.255.252.0/23 + 224.0.0.0/3