-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_foxyproxy.sh
executable file
·62 lines (57 loc) · 1.77 KB
/
gen_foxyproxy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
cat > china.domains.foxyproxy-patterns.json << 'EOF'
{
"whitePatterns": [
{
"title": "all URLs",
"pattern": "*",
"type": 1,
"protocols": 1,
"active": true
}
],
"blackPatterns": [
{
"title": "local hostnames (usually no dots in the name). Pattern exists because 'Do not use this proxy for localhost and intranet/private IP addresses' is checked.",
"pattern": "^(?:[^:@/]+(?::[^@/]+)?@)?(?:localhost|127\\.\\d+\\.\\d+\\.\\d+)(?::\\d+)?(?:/.*)?$",
"type": 2,
"protocols": 1,
"active": true
},
{
"title": "local subnets (IANA reserved address space). Pattern exists because 'Do not use this proxy for localhost and intranet/private IP addresses' is checked.",
"pattern": "^(?:[^:@/]+(?::[^@/]+)?@)?(?:192\\.168\\.\\d+\\.\\d+|10\\.\\d+\\.\\d+\\.\\d+|172\\.(?:1[6789]|2[0-9]|3[01])\\.\\d+\\.\\d+)(?::\\d+)?(?:/.*)?$",
"type": 2,
"protocols": 1,
"active": true
},
{
"title": "localhost - matches the local host optionally prefixed by a user:password authentication string and optionally suffixed by a port number. The entire local subnet (127.0.0.0/8) matches. Pattern exists because 'Do not use this proxy for localhost and intranet/private IP addresses' is checked.",
"pattern": "^(?:[^:@/]+(?::[^@/]+)?@)?[\\w-]+(?::\\d+)?(?:/.*)?$",
"type": 2,
"protocols": 1,
"active": true
},
EOF
for nm in `cat ./china.domains.txt`; do
cat >> china.domains.foxyproxy-patterns.json << EOF
{
"title": "${nm}",
"pattern": "*.${nm}",
"type": 1,
"protocols": 1,
"active": true
},
EOF
done
cat >> china.domains.foxyproxy-patterns.json << 'EOF'
{
"title": "cn",
"pattern": "*.cn",
"type": 1,
"protocols": 1,
"active": true
}
]
}
EOF