Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
19267732
Commit
19267732
authored
Feb 26, 2014
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update simple list
parent
e514745e
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2348 additions
and
842 deletions
+2348
-842
gfwlist/gen.py
gfwlist/gen.py
+59
-0
gfwlist/simplelist.txt
gfwlist/simplelist.txt
+1148
-0
src/main/res/values/arrays.xml
src/main/res/values/arrays.xml
+1141
-842
No files found.
gfwlist/gen.py
0 → 100644
View file @
19267732
#!/usr/bin/python
# -*- encoding: utf8 -*-
import
itertools
import
math
import
sys
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
)))
# 添加内网地址
internal_list
=
IPy
.
IPSet
(
map
(
IPy
.
IP
,
[
"0.0.0.0/8"
,
"10.0.0.0/8"
,
"100.64.0.0/10"
,
"127.0.0.0/8"
,
"169.254.0.0/16"
,
"172.16.0.0/12"
,
"192.0.0.0/29"
,
"192.0.2.0/24"
,
"192.88.99.0/24"
,
"192.168.0.0/16"
,
"198.18.0.0/15"
,
"198.51.100.0/24"
,
"203.0.113.0/24"
,
"224.0.0.0/4"
,
"240.0.0.0/4"
,
]))
china_list_set
+=
internal_list
# 取反
all
=
IPy
.
IPSet
([
IPy
.
IP
(
"0.0.0.0/0"
)])
# 剔除所有孤立的C段
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'
))
# 输出结果
for
ip
in
all
:
print
'<item>'
+
str
(
ip
)
+
'</item>'
if
__name__
==
"__main__"
:
main
()
gfwlist/simplelist.txt
0 → 100644
View file @
19267732
This diff is collapsed.
Click to expand it.
src/main/res/values/arrays.xml
View file @
19267732
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment