gfwlist2ipset 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/gfwlist2ipset +42 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec3da723af1f59cb914ccb38d3f2af34ce676af5
|
4
|
+
data.tar.gz: 627f9ac7ea9d24b522df3eb56a63ee0b67a47f80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37c9b55d69ac549e56a3e711c959ab146cc5613e39074b07e3eb243b257b64f33f101c7fd0126ba5336f4b997d1c5f2912053d40a18141df3328b8e56ad13807
|
7
|
+
data.tar.gz: 5b30ae6602d573d74cee1969202f033b0ff670eeeb6f2d2e92883c413902fb5a737ea7e865edf7b5df450d1830a4e02ad999bf2199822bd532b6d59342c05d43
|
data/bin/gfwlist2ipset
CHANGED
@@ -1,23 +1,52 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
2
3
|
require 'open-uri'
|
3
4
|
require 'base64'
|
4
5
|
require 'public_suffix'
|
5
6
|
|
7
|
+
options = {}
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = "Usage: gfwlist2ipset [options]"
|
10
|
+
|
11
|
+
opts.on('-d <DNS Server>', '--dns <DNS Server>', 'Set a DNS Server') do |value|
|
12
|
+
options[:dns] = value
|
13
|
+
end
|
14
|
+
|
15
|
+
options[:output] = 'gfwlist.conf'
|
16
|
+
opts.on('-o OUTPUT', '--output OUTPUT', 'Output file, default: gfwlist.conf') do |value|
|
17
|
+
options[:output] = value
|
18
|
+
end
|
19
|
+
end.parse!
|
20
|
+
|
6
21
|
gfwlist_url = 'https://autoproxy-gfwlist.googlecode.com/svn/trunk/gfwlist.txt'
|
7
22
|
extra_domains = [
|
23
|
+
"appledaily.com.hk",
|
24
|
+
"bbc.com",
|
8
25
|
"blogspot.com",
|
9
26
|
"fastly.net",
|
10
27
|
"githubusercontent.com",
|
11
28
|
"google-analytics.com",
|
12
|
-
"google.
|
29
|
+
"google.as",
|
13
30
|
"google.co.jp",
|
31
|
+
"google.co.id",
|
32
|
+
"google.co.th",
|
33
|
+
"google.co.uk",
|
14
34
|
"google.com",
|
15
35
|
"google.com.hk",
|
36
|
+
"google.com.tw",
|
16
37
|
"googlesyndication.com",
|
17
38
|
"s3.amazonaws.com",
|
18
39
|
"s3.feedly.com",
|
19
40
|
"cloudfront.net",
|
20
41
|
"ace-cdn.atlassian.com",
|
42
|
+
"wufoo.com",
|
43
|
+
"nextmedia.com",
|
44
|
+
"cxense.com",
|
45
|
+
"krxd.net",
|
46
|
+
"chartbeat.net",
|
47
|
+
"slack-files.com",
|
48
|
+
"fbinfer.com",
|
49
|
+
"line.naver.jp",
|
21
50
|
]
|
22
51
|
|
23
52
|
def get_hostname(rule)
|
@@ -73,7 +102,16 @@ plain.each_line do |line|
|
|
73
102
|
end
|
74
103
|
|
75
104
|
domains.concat extra_domains
|
76
|
-
File.open(
|
105
|
+
File.open(options[:output], 'w+') do |f|
|
77
106
|
f.puts '# Generated by gfwlist2ipset at ' + Time.new.inspect
|
78
|
-
|
79
|
-
|
107
|
+
if options.has_key?(:dns)
|
108
|
+
domains.sort.uniq.each do |domain|
|
109
|
+
f.puts('server=/' + domain + '/' + options[:dns])
|
110
|
+
f.puts('ipset=/' + domain + '/outwall')
|
111
|
+
end
|
112
|
+
else
|
113
|
+
domains.sort.uniq.each do |domain|
|
114
|
+
f.puts('ipset=/' + domain + '/outwall')
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gfwlist2ipset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nullizer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: public_suffix
|