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
9ed320d3
Commit
9ed320d3
authored
Sep 25, 2016
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #901
parent
2599e88a
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21303 additions
and
98 deletions
+21303
-98
src/main/assets/acl/bypass_chn.acl
src/main/assets/acl/bypass_chn.acl
+8415
-0
src/main/assets/acl/bypass_lan.acl
src/main/assets/acl/bypass_lan.acl
+14
-0
src/main/assets/acl/bypass_lan_chn.acl
src/main/assets/acl/bypass_lan_chn.acl
+8429
-0
src/main/assets/acl/chinalist.acl
src/main/assets/acl/chinalist.acl
+4425
-0
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
.../scala/com/github/shadowsocks/ShadowsocksNatService.scala
+10
-25
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+10
-25
src/main/scala/com/github/shadowsocks/utils/Constants.scala
src/main/scala/com/github/shadowsocks/utils/Constants.scala
+0
-48
No files found.
src/main/assets/acl/bypass_chn.acl
0 → 100644
View file @
9ed320d3
This diff is collapsed.
Click to expand it.
src/main/assets/acl/bypass_lan.acl
0 → 100644
View file @
9ed320d3
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/3
src/main/assets/acl/bypass_lan_chn.acl
0 → 100644
View file @
9ed320d3
This diff is collapsed.
Click to expand it.
src/main/assets/acl/chinalist.acl
0 → 100644
View file @
9ed320d3
This diff is collapsed.
Click to expand it.
src/main/scala/com/github/shadowsocks/ShadowsocksNatService.scala
View file @
9ed320d3
...
@@ -71,20 +71,6 @@ class ShadowsocksNatService extends BaseService {
...
@@ -71,20 +71,6 @@ class ShadowsocksNatService extends BaseService {
var
su
:
Shell.Interactive
=
_
var
su
:
Shell.Interactive
=
_
def
startShadowsocksDaemon
()
{
def
startShadowsocksDaemon
()
{
if
(
profile
.
route
!=
Route
.
ALL
&&
profile
.
route
!=
Route
.
GFWLIST
)
{
val
acl
:
Array
[
String
]
=
profile
.
route
match
{
case
Route
.
BYPASS_LAN
=>
getResources
.
getStringArray
(
R
.
array
.
private_route
)
case
Route
.
BYPASS_CHN
=>
getResources
.
getStringArray
(
R
.
array
.
chn_route
)
case
Route
.
BYPASS_LAN_CHN
=>
getResources
.
getStringArray
(
R
.
array
.
private_route
)
++
getResources
.
getStringArray
(
R
.
array
.
chn_route
)
case
Route
.
CHINALIST
=>
Array
(
"[bypass_all]"
,
"[white_list]"
)
++
getResources
.
getStringArray
(
R
.
array
.
chn_route
)
}
Utils
.
printToFile
(
new
File
(
getApplicationInfo
.
dataDir
+
"/acl.list"
))(
p
=>
{
acl
.
foreach
(
p
.
println
)
})
}
val
conf
=
if
(
profile
.
kcp
)
{
val
conf
=
if
(
profile
.
kcp
)
{
ConfigUtils
ConfigUtils
.
SHADOWSOCKS
.
formatLocal
(
Locale
.
ENGLISH
,
"127.0.0.1"
,
profile
.
localPort
+
90
,
profile
.
localPort
,
.
SHADOWSOCKS
.
formatLocal
(
Locale
.
ENGLISH
,
"127.0.0.1"
,
profile
.
localPort
+
90
,
profile
.
localPort
,
...
@@ -110,10 +96,13 @@ class ShadowsocksNatService extends BaseService {
...
@@ -110,10 +96,13 @@ class ShadowsocksNatService extends BaseService {
if
(
profile
.
route
!=
Route
.
ALL
)
{
if
(
profile
.
route
!=
Route
.
ALL
)
{
cmd
+=
"--acl"
cmd
+=
"--acl"
if
(
profile
.
route
==
Route
.
GFWLIST
)
profile
.
route
match
{
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/gfwlist.acl"
)
case
Route
.
BYPASS_LAN
=>
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/bypass_lan.acl"
)
else
case
Route
.
BYPASS_CHN
=>
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/bypass_chn.acl"
)
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/acl.list"
)
case
Route
.
BYPASS_LAN_CHN
=>
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/bypass_lan_chn.acl"
)
case
Route
.
GFWLIST
=>
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/gfwlist.acl"
)
case
Route
.
CHINALIST
=>
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/chinalist.acl"
)
}
}
}
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
.
mkString
(
" "
))
if
(
BuildConfig
.
DEBUG
)
Log
.
d
(
TAG
,
cmd
.
mkString
(
" "
))
...
@@ -190,16 +179,12 @@ class ShadowsocksNatService extends BaseService {
...
@@ -190,16 +179,12 @@ class ShadowsocksNatService extends BaseService {
def
startDnsDaemon
()
{
def
startDnsDaemon
()
{
val
conf
=
profile
.
route
match
{
val
conf
=
profile
.
route
match
{
case
Route
.
BYPASS_CHN
|
Route
.
BYPASS_LAN_CHN
=>
{
case
Route
.
BYPASS_CHN
|
Route
.
BYPASS_LAN_CHN
|
Route
.
GFWLIST
=>
{
ConfigUtils
.
PDNSD_DIRECT
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
ConfigUtils
.
PDNSD_DIRECT
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"127.0.0.1"
,
profile
.
localPort
+
53
,
""
,
profile
.
localPort
+
63
,
""
)
"127.0.0.1"
,
profile
.
localPort
+
53
,
"1.2.4.8, 114.114.114.114, 208.67.222.222"
,
""
,
profile
.
localPort
+
63
,
""
)
}
case
Route
.
GFWLIST
=>
{
ConfigUtils
.
PDNSD_UDP
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"127.0.0.1"
,
profile
.
localPort
+
53
,
"1.2.4.8, 208.67.222.222"
,
""
,
profile
.
localPort
+
63
,
""
)
}
}
case
Route
.
CHINALIST
=>
{
case
Route
.
CHINALIST
=>
{
ConfigUtils
.
PDNSD_
UDP
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
ConfigUtils
.
PDNSD_
DIRECT
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"127.0.0.1"
,
profile
.
localPort
+
53
,
"8.8.8.8, 208.67.222.222"
,
""
,
profile
.
localPort
+
63
,
""
)
"127.0.0.1"
,
profile
.
localPort
+
53
,
"8.8.8.8, 208.67.222.222"
,
""
,
profile
.
localPort
+
63
,
""
)
}
}
case
_
=>
{
case
_
=>
{
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
9ed320d3
...
@@ -226,20 +226,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -226,20 +226,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
}
}
def
startShadowsocksDaemon
()
{
def
startShadowsocksDaemon
()
{
if
(
profile
.
route
!=
Route
.
ALL
&&
profile
.
route
!=
Route
.
GFWLIST
)
{
val
acl
:
Array
[
String
]
=
profile
.
route
match
{
case
Route
.
BYPASS_LAN
=>
getResources
.
getStringArray
(
R
.
array
.
private_route
)
case
Route
.
BYPASS_CHN
=>
getResources
.
getStringArray
(
R
.
array
.
chn_route
)
case
Route
.
BYPASS_LAN_CHN
=>
getResources
.
getStringArray
(
R
.
array
.
private_route
)
++
getResources
.
getStringArray
(
R
.
array
.
chn_route
)
case
Route
.
CHINALIST
=>
Array
(
"[bypass_all]"
,
"[white_list]"
)
++
getResources
.
getStringArray
(
R
.
array
.
chn_route
)
}
Utils
.
printToFile
(
new
File
(
getApplicationInfo
.
dataDir
+
"/acl.list"
))(
p
=>
{
acl
.
foreach
(
p
.
println
)
})
}
val
conf
=
if
(
profile
.
kcp
)
{
val
conf
=
if
(
profile
.
kcp
)
{
ConfigUtils
ConfigUtils
.
SHADOWSOCKS
.
formatLocal
(
Locale
.
ENGLISH
,
"127.0.0.1"
,
profile
.
localPort
+
90
,
profile
.
localPort
,
.
SHADOWSOCKS
.
formatLocal
(
Locale
.
ENGLISH
,
"127.0.0.1"
,
profile
.
localPort
+
90
,
profile
.
localPort
,
...
@@ -265,10 +251,13 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -265,10 +251,13 @@ class ShadowsocksVpnService extends VpnService with BaseService {
if
(
profile
.
route
!=
Route
.
ALL
)
{
if
(
profile
.
route
!=
Route
.
ALL
)
{
cmd
+=
"--acl"
cmd
+=
"--acl"
if
(
profile
.
route
==
Route
.
GFWLIST
)
profile
.
route
match
{
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/gfwlist.acl"
)
case
Route
.
BYPASS_LAN
=>
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/bypass_lan.acl"
)
else
case
Route
.
BYPASS_CHN
=>
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/bypass_chn.acl"
)
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/acl.list"
)
case
Route
.
BYPASS_LAN_CHN
=>
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/bypass_lan_chn.acl"
)
case
Route
.
GFWLIST
=>
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/gfwlist.acl"
)
case
Route
.
CHINALIST
=>
cmd
+=
(
getApplicationInfo
.
dataDir
+
"/chinalist.acl"
)
}
}
}
if
(
TcpFastOpen
.
sendEnabled
)
cmd
+=
"--fast-open"
if
(
TcpFastOpen
.
sendEnabled
)
cmd
+=
"--fast-open"
...
@@ -310,16 +299,12 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -310,16 +299,12 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def
startDnsDaemon
()
{
def
startDnsDaemon
()
{
val
ipv6
=
if
(
profile
.
ipv6
)
""
else
"reject = ::/0;"
val
ipv6
=
if
(
profile
.
ipv6
)
""
else
"reject = ::/0;"
val
conf
=
profile
.
route
match
{
val
conf
=
profile
.
route
match
{
case
Route
.
BYPASS_CHN
|
Route
.
BYPASS_LAN_CHN
=>
{
case
Route
.
BYPASS_CHN
|
Route
.
BYPASS_LAN_CHN
|
Route
.
GFWLIST
=>
{
ConfigUtils
.
PDNSD_DIRECT
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
ConfigUtils
.
PDNSD_DIRECT
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"0.0.0.0"
,
profile
.
localPort
+
53
,
ipv6
,
profile
.
localPort
+
63
,
ipv6
)
"0.0.0.0"
,
profile
.
localPort
+
53
,
"1.2.4.8, 114.114.114.114, 208.67.222.222"
,
ipv6
,
profile
.
localPort
+
63
,
ipv6
)
}
case
Route
.
GFWLIST
=>
{
ConfigUtils
.
PDNSD_UDP
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"0.0.0.0"
,
profile
.
localPort
+
53
,
"1.2.4.8, 208.67.222.222"
,
ipv6
,
profile
.
localPort
+
63
,
ipv6
)
}
}
case
Route
.
CHINALIST
=>
{
case
Route
.
CHINALIST
=>
{
ConfigUtils
.
PDNSD_
UDP
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
ConfigUtils
.
PDNSD_
DIRECT
.
formatLocal
(
Locale
.
ENGLISH
,
getApplicationInfo
.
dataDir
,
"0.0.0.0"
,
profile
.
localPort
+
53
,
"8.8.8.8, 208.67.222.222"
,
ipv6
,
profile
.
localPort
+
63
,
ipv6
)
"0.0.0.0"
,
profile
.
localPort
+
53
,
"8.8.8.8, 208.67.222.222"
,
ipv6
,
profile
.
localPort
+
63
,
ipv6
)
}
}
case
_
=>
{
case
_
=>
{
...
...
src/main/scala/com/github/shadowsocks/utils/Constants.scala
View file @
9ed320d3
...
@@ -115,58 +115,12 @@ object ConfigUtils {
...
@@ -115,58 +115,12 @@ object ConfigUtils {
|}
|}
|
|
|server {
|server {
| label = "china-servers";
| ip = 1.2.4.8, 208.67.222.222, 114.114.114.114;
| timeout = 4;
| uptest = none;
| preset = on;
| %s
| reject_policy = negate;
| reject_recursively = on;
|}
|
|server {
| label = "local-server";
| ip = 127.0.0.1;
| port = %d;
| %s
| reject_policy = negate;
| reject_recursively = on;
|}
|
|rr {
| name=localhost;
| reverse=on;
| a=127.0.0.1;
| owner=localhost;
| soa=localhost,root.localhost,42,86400,900,86400,86400;
|}
"""
.
stripMargin
val
PDNSD_UDP
=
"""
|global {
| perm_cache = 2048;
| cache_dir = "%s";
| server_ip = %s;
| server_port = %d;
| query_method = udp_tcp;
| run_ipv4 = on;
| min_ttl = 15m;
| max_ttl = 1w;
| timeout = 10;
| daemon = off;
|}
|
|server {
| label = "remote-servers";
| label = "remote-servers";
| ip = %s;
| ip = %s;
| timeout = 5;
| timeout = 5;
| uptest = none;
| uptest = none;
| preset = on;
| preset = on;
| %s
| %s
| reject_policy = negate;
| reject_recursively = on;
|}
|}
|
|
|server {
|server {
...
@@ -174,8 +128,6 @@ object ConfigUtils {
...
@@ -174,8 +128,6 @@ object ConfigUtils {
| ip = 127.0.0.1;
| ip = 127.0.0.1;
| port = %d;
| port = %d;
| %s
| %s
| reject_policy = negate;
| reject_recursively = on;
|}
|}
|
|
|rr {
|rr {
...
...
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