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
25bd9149
Commit
25bd9149
authored
May 06, 2013
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update gfw list
parent
9f2052e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
26 deletions
+40
-26
src/main/res/values/arrays.xml
src/main/res/values/arrays.xml
+0
-1
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
+5
-1
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
+35
-24
No files found.
src/main/res/values/arrays.xml
View file @
25bd9149
...
...
@@ -521,7 +521,6 @@
<item>
124.219
</item>
<item>
124.244
</item>
<item>
125.6
</item>
<item>
127.0
</item>
<item>
128.100
</item>
<item>
128.241
</item>
<item>
131.84
</item>
...
...
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
View file @
25bd9149
...
...
@@ -236,6 +236,7 @@ class ShadowVpnService extends VpnService {
.
setMtu
(
VPN_MTU
)
.
addAddress
(
"172.16.0.1"
,
24
)
.
addDnsServer
(
"8.8.8.8"
)
.
addDnsServer
(
"8.8.4.4"
)
if
(
InetAddressUtils
.
isIPv6Address
(
appHost
))
{
builder
.
addRoute
(
"0.0.0.0"
,
0
)
...
...
@@ -244,8 +245,11 @@ class ShadowVpnService extends VpnService {
val
address
=
appHost
.
split
(
'.'
)
val
prefix
=
address
(
0
)
+
"."
+
address
(
1
)
gfwList
.
foreach
(
addr
=>
if
(
addr
!=
prefix
)
builder
.
addRoute
(
prefix
+
".0.0"
,
16
)
if
(
addr
!=
prefix
)
{
builder
.
addRoute
(
addr
+
".0.0"
,
16
)
}
)
builder
.
addRoute
(
"8.8.0.0"
,
16
)
}
else
{
val
prefix
=
appHost
.
split
(
'.'
)(
0
).
toInt
for
(
i
<-
1
to
254
)
{
...
...
src/main/scala/com/github/shadowsocks/Shadowsocks.scala
View file @
25bd9149
...
...
@@ -313,28 +313,6 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
}
}.
start
()
}
if
(
isServiceStarted
)
{
switchButton
.
setChecked
(
true
)
if
(
ShadowVpnService
.
isServiceStarted
)
{
val
style
=
new
Style
.
Builder
()
.
setBackgroundColorValue
(
Style
.
holoBlueLight
)
.
setDuration
(
Style
.
DURATION_INFINITE
)
.
build
()
switchButton
.
setEnabled
(
false
)
Crouton
.
makeText
(
Shadowsocks
.
this
,
R
.
string
.
vpn_status
,
style
).
show
()
}
}
else
{
switchButton
.
setChecked
(
false
)
if
(
settings
.
getBoolean
(
"isRunning"
,
false
))
{
new
Thread
{
override
def
run
()
{
crash_recovery
()
handler
.
sendEmptyMessage
(
MSG_CRASH_RECOVER
)
}
}.
start
()
}
}
}
override
def
onCreateOptionsMenu
(
menu
:
Menu
)
:
Boolean
=
{
...
...
@@ -376,6 +354,11 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
super
.
onOptionsItemSelected
(
item
)
}
protected
override
def
onNewIntent
(
intent
:
Intent
)
{
super
.
onNewIntent
(
intent
)
setIntent
(
intent
)
}
protected
override
def
onPause
()
{
super
.
onPause
()
PreferenceManager
.
getDefaultSharedPreferences
(
this
).
unregisterOnSharedPreferenceChangeListener
(
this
)
...
...
@@ -383,7 +366,32 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
protected
override
def
onResume
()
{
super
.
onResume
()
val
settings
:
SharedPreferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
)
if
(
getIntent
.
getAction
!=
Shadowsocks
.
REQUEST_CONNECT
)
{
val
settings
:
SharedPreferences
=
PreferenceManager
.
getDefaultSharedPreferences
(
this
)
if
(
isServiceStarted
)
{
switchButton
.
setChecked
(
true
)
if
(
ShadowVpnService
.
isServiceStarted
)
{
val
style
=
new
Style
.
Builder
()
.
setBackgroundColorValue
(
Style
.
holoBlueLight
)
.
setDuration
(
Style
.
DURATION_INFINITE
)
.
build
()
switchButton
.
setEnabled
(
false
)
Crouton
.
makeText
(
Shadowsocks
.
this
,
R
.
string
.
vpn_status
,
style
).
show
()
}
}
else
{
switchButton
.
setEnabled
(
true
)
switchButton
.
setChecked
(
false
)
Crouton
.
cancelAllCroutons
()
if
(
settings
.
getBoolean
(
"isRunning"
,
false
))
{
new
Thread
{
override
def
run
()
{
crash_recovery
()
handler
.
sendEmptyMessage
(
MSG_CRASH_RECOVER
)
}
}.
start
()
}
}
}
setPreferenceEnabled
()
switchButton
.
setOnCheckedChangeListener
(
this
)
PreferenceManager
.
getDefaultSharedPreferences
(
this
).
registerOnSharedPreferenceChangeListener
(
this
)
...
...
@@ -419,7 +427,10 @@ class Shadowsocks extends UnifiedSherlockPreferenceActivity with CompoundButton.
if
(!
switchButton
.
isChecked
)
switchButton
.
setChecked
(
true
)
}
else
{
if
(
switchButton
.
isChecked
)
switchButton
.
setChecked
(
false
)
if
(
switchButton
.
isChecked
)
{
switchButton
.
setEnabled
(
true
)
switchButton
.
setChecked
(
false
)
}
}
}
if
(
key
==
"isConnecting"
)
{
...
...
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