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
efb61403
Commit
efb61403
authored
Nov 17, 2014
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable NAT mode again
parent
8f41ea29
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
22 deletions
+24
-22
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+10
-8
src/main/scala/com/github/shadowsocks/ShadowsocksRunnerActivity.scala
...la/com/github/shadowsocks/ShadowsocksRunnerActivity.scala
+1
-1
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
.../scala/com/github/shadowsocks/ShadowsocksVpnService.scala
+5
-13
src/main/scala/com/github/shadowsocks/utils/Utils.scala
src/main/scala/com/github/shadowsocks/utils/Utils.scala
+8
-0
No files found.
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
efb61403
...
@@ -338,13 +338,15 @@ class Shadowsocks
...
@@ -338,13 +338,15 @@ class Shadowsocks
Console
.
runCommand
(
ab
.
toArray
)
Console
.
runCommand
(
ab
.
toArray
)
ab
.
clear
()
if
(!
Utils
.
isLollipopOrAbove
)
{
ab
.
append
(
"kill -9 `cat /data/data/com.github.shadowsocks/redsocks.pid`"
)
ab
.
clear
()
ab
.
append
(
"rm /data/data/com.github.shadowsocks/redsocks.conf"
)
ab
.
append
(
"kill -9 `cat /data/data/com.github.shadowsocks/redsocks.pid`"
)
ab
.
append
(
"rm /data/data/com.github.shadowsocks/redsocks.pid"
)
ab
.
append
(
"rm /data/data/com.github.shadowsocks/redsocks.conf"
)
ab
.
append
(
Utils
.
getIptables
+
" -t nat -F OUTPUT"
)
ab
.
append
(
"rm /data/data/com.github.shadowsocks/redsocks.pid"
)
ab
.
append
(
Utils
.
getIptables
+
" -t nat -F OUTPUT"
)
Console
.
runRootCommand
(
ab
.
toArray
)
Console
.
runRootCommand
(
ab
.
toArray
)
}
}
}
private
def
getVersionName
:
String
=
{
private
def
getVersionName
:
String
=
{
...
@@ -500,7 +502,7 @@ class Shadowsocks
...
@@ -500,7 +502,7 @@ class Shadowsocks
// Bind to the service
// Bind to the service
spawn
{
spawn
{
val
isRoot
=
Console
.
isRoot
val
isRoot
=
!
Utils
.
isLollipopOrAbove
&&
Console
.
isRoot
handler
.
post
(
new
Runnable
{
handler
.
post
(
new
Runnable
{
override
def
run
()
{
override
def
run
()
{
status
.
edit
.
putBoolean
(
Key
.
isRoot
,
isRoot
).
commit
()
status
.
edit
.
putBoolean
(
Key
.
isRoot
,
isRoot
).
commit
()
...
@@ -770,7 +772,7 @@ class Shadowsocks
...
@@ -770,7 +772,7 @@ class Shadowsocks
if
(
pref
!=
null
)
{
if
(
pref
!=
null
)
{
if
(
Seq
(
Key
.
isGlobalProxy
,
Key
.
proxyedApps
)
if
(
Seq
(
Key
.
isGlobalProxy
,
Key
.
proxyedApps
)
.
contains
(
name
))
{
.
contains
(
name
))
{
pref
.
setEnabled
(
enabled
&&
!
isVpnEnabled
)
pref
.
setEnabled
(
enabled
&&
(
Utils
.
isLollipopOrAbove
||
!
isVpnEnabled
)
)
}
else
{
}
else
{
pref
.
setEnabled
(
enabled
)
pref
.
setEnabled
(
enabled
)
}
}
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksRunnerActivity.scala
View file @
efb61403
...
@@ -72,7 +72,7 @@ class ShadowsocksRunnerActivity extends Activity {
...
@@ -72,7 +72,7 @@ class ShadowsocksRunnerActivity extends Activity {
def
isVpnEnabled
:
Boolean
=
{
def
isVpnEnabled
:
Boolean
=
{
if
(
vpnEnabled
<
0
)
{
if
(
vpnEnabled
<
0
)
{
vpnEnabled
=
if
(!
Console
.
isRoot
)
{
vpnEnabled
=
if
(
Utils
.
isLollipopOrAbove
||
!
Console
.
isRoot
)
{
1
1
}
else
{
}
else
{
0
0
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksVpnService.scala
View file @
efb61403
...
@@ -74,14 +74,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -74,14 +74,6 @@ class ShadowsocksVpnService extends VpnService with BaseService {
private
lazy
val
application
=
getApplication
.
asInstanceOf
[
ShadowsocksApplication
]
private
lazy
val
application
=
getApplication
.
asInstanceOf
[
ShadowsocksApplication
]
def
isLollipopOrAbove
:
Boolean
=
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
true
}
else
{
false
}
}
def
isByass
(
net
:
SubnetUtils
)
:
Boolean
=
{
def
isByass
(
net
:
SubnetUtils
)
:
Boolean
=
{
val
info
=
net
.
getInfo
val
info
=
net
.
getInfo
info
.
isInRange
(
config
.
proxy
)
info
.
isInRange
(
config
.
proxy
)
...
@@ -105,7 +97,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -105,7 +97,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def
startShadowsocksDaemon
()
{
def
startShadowsocksDaemon
()
{
if
(
isLollipopOrAbove
&&
config
.
route
!=
Route
.
ALL
)
{
if
(
Utils
.
isLollipopOrAbove
&&
config
.
route
!=
Route
.
ALL
)
{
val
acl
:
Array
[
String
]
=
config
.
route
match
{
val
acl
:
Array
[
String
]
=
config
.
route
match
{
case
Route
.
BYPASS_LAN
=>
getResources
.
getStringArray
(
R
.
array
.
private_route
)
case
Route
.
BYPASS_LAN
=>
getResources
.
getStringArray
(
R
.
array
.
private_route
)
case
Route
.
BYPASS_CHN
=>
getResources
.
getStringArray
(
R
.
array
.
chn_route_full
)
case
Route
.
BYPASS_CHN
=>
getResources
.
getStringArray
(
R
.
array
.
chn_route_full
)
...
@@ -125,7 +117,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -125,7 +117,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
,
"-m"
,
config
.
encMethod
,
"-m"
,
config
.
encMethod
,
"-f"
,
Path
.
BASE
+
"ss-local.pid"
)
,
"-f"
,
Path
.
BASE
+
"ss-local.pid"
)
if
(
isLollipopOrAbove
&&
config
.
route
!=
Route
.
ALL
)
{
if
(
Utils
.
isLollipopOrAbove
&&
config
.
route
!=
Route
.
ALL
)
{
cmd
+=
"--acl"
cmd
+=
"--acl"
cmd
+=
(
Path
.
BASE
+
"acl.list"
)
cmd
+=
(
Path
.
BASE
+
"acl.list"
)
}
}
...
@@ -151,7 +143,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -151,7 +143,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
def
startDnsDaemon
()
{
def
startDnsDaemon
()
{
val
conf
=
{
val
conf
=
{
if
(
isLollipopOrAbove
)
{
if
(
Utils
.
isLollipopOrAbove
)
{
ConfigUtils
.
PDNSD_BYPASS
.
format
(
"0.0.0.0"
,
getString
(
R
.
string
.
exclude
),
8163
)
ConfigUtils
.
PDNSD_BYPASS
.
format
(
"0.0.0.0"
,
getString
(
R
.
string
.
exclude
),
8163
)
}
else
{
}
else
{
ConfigUtils
.
PDNSD_LOCAL
.
format
(
"0.0.0.0"
,
8163
)
ConfigUtils
.
PDNSD_LOCAL
.
format
(
"0.0.0.0"
,
8163
)
...
@@ -186,7 +178,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -186,7 +178,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
.
addAddress
(
PRIVATE_VLAN
.
format
(
"1"
),
24
)
.
addAddress
(
PRIVATE_VLAN
.
format
(
"1"
),
24
)
.
addDnsServer
(
"8.8.8.8"
)
.
addDnsServer
(
"8.8.8.8"
)
if
(
isLollipopOrAbove
)
{
if
(
Utils
.
isLollipopOrAbove
)
{
if
(!
config
.
isGlobalProxy
)
{
if
(!
config
.
isGlobalProxy
)
{
val
apps
=
AppManager
.
getProxiedApps
(
this
,
config
.
proxiedAppString
)
val
apps
=
AppManager
.
getProxiedApps
(
this
,
config
.
proxiedAppString
)
val
pkgSet
:
mutable.HashSet
[
String
]
=
new
mutable
.
HashSet
[
String
]
val
pkgSet
:
mutable.HashSet
[
String
]
=
new
mutable
.
HashSet
[
String
]
...
@@ -214,7 +206,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
...
@@ -214,7 +206,7 @@ class ShadowsocksVpnService extends VpnService with BaseService {
if
(
InetAddressUtils
.
isIPv6Address
(
config
.
proxy
))
{
if
(
InetAddressUtils
.
isIPv6Address
(
config
.
proxy
))
{
builder
.
addRoute
(
"0.0.0.0"
,
0
)
builder
.
addRoute
(
"0.0.0.0"
,
0
)
}
else
{
}
else
{
if
(!
isLollipopOrAbove
)
{
if
(!
Utils
.
isLollipopOrAbove
)
{
config
.
route
match
{
config
.
route
match
{
case
Route
.
ALL
=>
case
Route
.
ALL
=>
for
(
i
<-
1
to
223
)
{
for
(
i
<-
1
to
223
)
{
...
...
src/main/scala/com/github/shadowsocks/utils/Utils.scala
View file @
efb61403
...
@@ -80,6 +80,14 @@ object Utils {
...
@@ -80,6 +80,14 @@ object Utils {
var
data_path
:
String
=
null
var
data_path
:
String
=
null
var
rootTries
=
0
var
rootTries
=
0
def
isLollipopOrAbove
:
Boolean
=
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
true
}
else
{
false
}
}
def
getSignature
(
context
:
Context
)
:
String
=
{
def
getSignature
(
context
:
Context
)
:
String
=
{
val
info
=
context
val
info
=
context
.
getPackageManager
.
getPackageManager
...
...
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