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
9296f7c6
Commit
9296f7c6
authored
May 06, 2013
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some issues
parent
eb174247
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
30 deletions
+30
-30
.travis.yml
.travis.yml
+1
-1
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
+8
-5
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+21
-24
No files found.
.travis.yml
View file @
9296f7c6
...
@@ -17,5 +17,5 @@ script:
...
@@ -17,5 +17,5 @@ script:
-
wget https://raw.github.com/paulp/sbt-extras/master/sbt
-
wget https://raw.github.com/paulp/sbt-extras/master/sbt
-
chmod u+x ./sbt
-
chmod u+x ./sbt
-
cp local.sbt.example local.sbt
-
cp local.sbt.example local.sbt
-
./sbt android:package-
release
-
./sbt android:package-
debug
-
./sbt deploy
-
./sbt deploy
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
View file @
9296f7c6
...
@@ -71,8 +71,6 @@ object ShadowVpnService {
...
@@ -71,8 +71,6 @@ object ShadowVpnService {
var
sRunningInstance
:
WeakReference
[
ShadowVpnService
]
=
null
var
sRunningInstance
:
WeakReference
[
ShadowVpnService
]
=
null
var
sConn
:
ParcelFileDescriptor
=
null
}
}
class
ShadowVpnService
extends
VpnService
{
class
ShadowVpnService
extends
VpnService
{
...
@@ -87,6 +85,7 @@ class ShadowVpnService extends VpnService {
...
@@ -87,6 +85,7 @@ class ShadowVpnService extends VpnService {
val
MSG_HOST_CHANGE
:
Int
=
4
val
MSG_HOST_CHANGE
:
Int
=
4
val
MSG_STOP_SELF
:
Int
=
5
val
MSG_STOP_SELF
:
Int
=
5
val
VPN_MTU
=
1500
val
VPN_MTU
=
1500
var
conn
:
ParcelFileDescriptor
=
null
def
getPid
(
name
:
String
)
:
Int
=
{
def
getPid
(
name
:
String
)
:
Int
=
{
try
{
try
{
...
@@ -243,13 +242,13 @@ class ShadowVpnService extends VpnService {
...
@@ -243,13 +242,13 @@ class ShadowVpnService extends VpnService {
&&
i
!=
172
&&
i
!=
192
&&
i
!=
10
)
builder
.
addRoute
(
i
+
".0.0.0"
,
8
)
&&
i
!=
172
&&
i
!=
192
&&
i
!=
10
)
builder
.
addRoute
(
i
+
".0.0.0"
,
8
)
}
}
ShadowVpnService
.
sC
onn
=
builder
.
establish
()
c
onn
=
builder
.
establish
()
if
(
ShadowVpnService
.
sC
onn
==
null
)
{
if
(
c
onn
==
null
)
{
stopSelf
()
stopSelf
()
return
return
}
}
val
fd
=
ShadowVpnService
.
sC
onn
.
getFd
val
fd
=
c
onn
.
getFd
val
cmd
=
(
BASE
+
"tun2socks --netif-ipaddr 172.16.0.2 --udpgw-remote-server-addr 158.255.208.201:7300 "
+
val
cmd
=
(
BASE
+
"tun2socks --netif-ipaddr 172.16.0.2 --udpgw-remote-server-addr 158.255.208.201:7300 "
+
"--netif-netmask 255.255.255.0 --socks-server-addr 127.0.0.1:%d --tunfd %d --tunmtu %d --pid "
+
BASE
+
"tun2socks.pid"
)
"--netif-netmask 255.255.255.0 --socks-server-addr 127.0.0.1:%d --tunfd %d --tunmtu %d --pid "
+
BASE
+
"tun2socks.pid"
)
...
@@ -315,6 +314,10 @@ class ShadowVpnService extends VpnService {
...
@@ -315,6 +314,10 @@ class ShadowVpnService extends VpnService {
ed
.
putBoolean
(
"isRunning"
,
false
)
ed
.
putBoolean
(
"isRunning"
,
false
)
ed
.
putBoolean
(
"isConnecting"
,
false
)
ed
.
putBoolean
(
"isConnecting"
,
false
)
ed
.
commit
ed
.
commit
if
(
conn
!=
null
)
{
conn
.
close
()
conn
=
null
}
super
.
onDestroy
()
super
.
onDestroy
()
markServiceStopped
()
markServiceStopped
()
}
}
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
9296f7c6
...
@@ -362,27 +362,28 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
...
@@ -362,27 +362,28 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
protected
override
def
onResume
()
{
protected
override
def
onResume
()
{
super
.
onResume
()
super
.
onResume
()
val
settings
:
SharedPreferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
)
val
settings
:
SharedPreferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
)
if
(
isServiceStarted
)
{
if
(
getIntent
.
getAction
!=
Shadowsocks
.
REQUEST_CONNECT
)
{
switchButton
.
setChecked
(
true
)
if
(
isServiceStarted
)
{
if
(
ShadowVpnService
.
isServiceStarted
)
{
switchButton
.
setChecked
(
true
)
val
style
=
new
Style
.
Builder
()
if
(
ShadowVpnService
.
isServiceStarted
)
{
.
setBackgroundColorValue
(
Style
.
holoBlueLight
)
val
style
=
new
Style
.
Builder
()
.
setDuration
(
Style
.
DURATION_INFINITE
)
.
setBackgroundColorValue
(
Style
.
holoBlueLight
)
.
build
()
.
setDuration
(
Style
.
DURATION_INFINITE
)
switchButton
.
setEnabled
(
false
)
.
build
()
Crouton
.
makeText
(
Shadowsocks
.
this
,
R
.
string
.
vpn_status
,
style
).
show
()
switchButton
.
setEnabled
(
false
)
}
Crouton
.
makeText
(
Shadowsocks
.
this
,
R
.
string
.
vpn_status
,
style
).
show
()
}
}
else
{
}
else
{
if
(
settings
.
getBoolean
(
"isRunning"
,
false
))
{
switchButton
.
setChecked
(
false
)
new
Thread
{
if
(
settings
.
getBoolean
(
"isRunning"
,
false
))
{
override
def
run
()
{
new
Thread
{
crash_recovery
()
override
def
run
()
{
handler
.
sendEmptyMessage
(
MSG_CRASH_RECOVER
)
crash_recovery
()
}
handler
.
sendEmptyMessage
(
MSG_CRASH_RECOVER
)
}.
start
()
}
}.
start
()
}
}
}
switchButton
.
setChecked
(
false
)
}
}
setPreferenceEnabled
()
setPreferenceEnabled
()
switchButton
.
setOnCheckedChangeListener
(
this
)
switchButton
.
setOnCheckedChangeListener
(
this
)
...
@@ -517,10 +518,6 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
...
@@ -517,10 +518,6 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
def
serviceStop
()
{
def
serviceStop
()
{
if
(
ShadowVpnService
.
isServiceStarted
)
{
if
(
ShadowVpnService
.
isServiceStarted
)
{
if
(
ShadowVpnService
.
sConn
!=
null
)
{
ShadowVpnService
.
sConn
.
close
()
ShadowVpnService
.
sConn
=
null
}
stopService
(
new
Intent
(
this
,
classOf
[
ShadowVpnService
]))
stopService
(
new
Intent
(
this
,
classOf
[
ShadowVpnService
]))
}
}
if
(
ShadowsocksService
.
isServiceStarted
)
{
if
(
ShadowsocksService
.
isServiceStarted
)
{
...
...
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