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
b77a599e
Commit
b77a599e
authored
Oct 29, 2013
by
Max Lv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refine proxy list refresing
parent
93a26969
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
14 deletions
+21
-14
build.sbt
build.sbt
+2
-1
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
+8
-6
src/main/scala/com/github/shadowsocks/ShadowsocksService.scala
...ain/scala/com/github/shadowsocks/ShadowsocksService.scala
+8
-6
src/main/scala/com/github/shadowsocks/Utils.scala
src/main/scala/com/github/shadowsocks/Utils.scala
+3
-1
No files found.
build.sbt
View file @
b77a599e
...
@@ -2,7 +2,8 @@ libraryDependencies ++= Seq(
...
@@ -2,7 +2,8 @@ libraryDependencies ++= Seq(
"com.google.android"
%
"support-v4"
%
"r12"
,
"com.google.android"
%
"support-v4"
%
"r12"
,
"com.google.android"
%
"analytics"
%
"3.01"
,
"com.google.android"
%
"analytics"
%
"3.01"
,
"com.google.android"
%
"admob"
%
"6.4.1"
,
"com.google.android"
%
"admob"
%
"6.4.1"
,
"dnsjava"
%
"dnsjava"
%
"2.1.5"
"dnsjava"
%
"dnsjava"
%
"2.1.5"
,
"org.scalaj"
%%
"scalaj-http"
%
"0.3.10"
)
)
libraryDependencies
++=
Seq
(
libraryDependencies
++=
Seq
(
...
...
src/main/scala/com/github/shadowsocks/ShadowVpnService.scala
View file @
b77a599e
...
@@ -191,13 +191,15 @@ class ShadowVpnService extends VpnService {
...
@@ -191,13 +191,15 @@ class ShadowVpnService extends VpnService {
if
(
config
.
proxy
==
"198.199.101.152"
)
{
if
(
config
.
proxy
==
"198.199.101.152"
)
{
val
container
=
getApplication
.
asInstanceOf
[
ShadowsocksApplication
].
tagContainer
val
container
=
getApplication
.
asInstanceOf
[
ShadowsocksApplication
].
tagContainer
if
(
container
==
null
)
{
try
{
notifyAlert
(
getString
(
R
.
string
.
forward_fail
),
getString
(
R
.
string
.
service_failed
))
stopSelf
()
handler
.
sendEmptyMessageDelayed
(
MSG_CONNECT_FAIL
,
500
)
return
}
else
{
config
=
Config
.
getPublicConfig
(
container
,
config
)
config
=
Config
.
getPublicConfig
(
container
,
config
)
}
catch
{
case
ex
:
Exception
=>
{
notifyAlert
(
getString
(
R
.
string
.
forward_fail
),
getString
(
R
.
string
.
service_failed
))
stopSelf
()
handler
.
sendEmptyMessageDelayed
(
MSG_CONNECT_FAIL
,
500
)
return
}
}
}
}
}
...
...
src/main/scala/com/github/shadowsocks/ShadowsocksService.scala
View file @
b77a599e
...
@@ -227,13 +227,15 @@ class ShadowsocksService extends Service {
...
@@ -227,13 +227,15 @@ class ShadowsocksService extends Service {
if
(
config
.
proxy
==
"198.199.101.152"
)
{
if
(
config
.
proxy
==
"198.199.101.152"
)
{
val
container
=
getApplication
.
asInstanceOf
[
ShadowsocksApplication
].
tagContainer
val
container
=
getApplication
.
asInstanceOf
[
ShadowsocksApplication
].
tagContainer
if
(
container
==
null
)
{
try
{
notifyAlert
(
getString
(
R
.
string
.
forward_fail
),
getString
(
R
.
string
.
service_failed
))
stopSelf
()
handler
.
sendEmptyMessageDelayed
(
MSG_CONNECT_FAIL
,
500
)
return
}
else
{
config
=
Config
.
getPublicConfig
(
container
,
config
)
config
=
Config
.
getPublicConfig
(
container
,
config
)
}
catch
{
case
ex
:
Exception
=>
{
notifyAlert
(
getString
(
R
.
string
.
forward_fail
),
getString
(
R
.
string
.
service_failed
))
stopSelf
()
handler
.
sendEmptyMessageDelayed
(
MSG_CONNECT_FAIL
,
500
)
return
}
}
}
}
}
...
...
src/main/scala/com/github/shadowsocks/Utils.scala
View file @
b77a599e
...
@@ -53,6 +53,7 @@ import android.app.ActivityManager
...
@@ -53,6 +53,7 @@ import android.app.ActivityManager
import
android.os.Build
import
android.os.Build
import
android.provider.Settings
import
android.provider.Settings
import
scala.Some
import
scala.Some
import
scalaj.http.
{
Http
,
HttpOptions
}
import
com.google.tagmanager.Container
import
com.google.tagmanager.Container
object
Config
{
object
Config
{
...
@@ -117,7 +118,8 @@ object Config {
...
@@ -117,7 +118,8 @@ object Config {
}
}
def
getPublicConfig
(
container
:
Container
,
config
:
Config
)
:
Config
=
{
def
getPublicConfig
(
container
:
Container
,
config
:
Config
)
:
Config
=
{
val
list
=
container
.
getString
(
"proxy_list"
)
val
url
=
container
.
getString
(
"proxy_url"
)
val
list
=
Http
(
url
).
option
(
HttpOptions
.
connTimeout
(
1000
)).
option
(
HttpOptions
.
readTimeout
(
5000
)).
asString
val
proxies
=
util
.
Random
.
shuffle
(
list
.
split
(
'|'
).
toSeq
).
toSeq
val
proxies
=
util
.
Random
.
shuffle
(
list
.
split
(
'|'
).
toSeq
).
toSeq
val
proxy
=
proxies
(
0
).
split
(
':'
)
val
proxy
=
proxies
(
0
).
split
(
':'
)
...
...
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