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
a4f32615
Commit
a4f32615
authored
Dec 27, 2016
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine "Replace HttpRequest with OkHttp3"
parent
e782a4c7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
19 deletions
+6
-19
build.sbt
build.sbt
+1
-1
src/main/scala/com/github/shadowsocks/BaseService.scala
src/main/scala/com/github/shadowsocks/BaseService.scala
+5
-18
No files found.
build.sbt
View file @
a4f32615
...
...
@@ -46,7 +46,7 @@ libraryDependencies ++=
"com.google.android.gms"
%
"play-services-gcm"
%
"10.0.1"
::
"com.j256.ormlite"
%
"ormlite-android"
%
"5.0"
::
"com.mikepenz"
%
"fastadapter"
%
"2.1.5"
::
"com.mikepenz"
%
"iconics-core"
%
"2.8.
1
"
::
"com.mikepenz"
%
"iconics-core"
%
"2.8.
2
"
::
"com.mikepenz"
%
"materialdrawer"
%
"5.8.1"
::
"com.mikepenz"
%
"materialize"
%
"1.0.0"
::
"com.twofortyfouram"
%
"android-plugin-api-for-locale"
%
"1.0.2"
::
...
...
src/main/scala/com/github/shadowsocks/BaseService.scala
View file @
a4f32615
...
...
@@ -21,9 +21,8 @@
package
com.github.shadowsocks
import
java.io.IOException
import
java.util.concurrent.TimeUnit
;
import
java.util.
{
Arrays
,
List
,
Timer
,
TimerTask
}
import
java.net.InetAddress
import
java.util.concurrent.TimeUnit
import
java.util.
{
Timer
,
TimerTask
}
import
android.app.Service
import
android.content.
{
BroadcastReceiver
,
Context
,
Intent
,
IntentFilter
}
...
...
@@ -36,21 +35,9 @@ import com.github.shadowsocks.ShadowsocksApplication.app
import
com.github.shadowsocks.aidl.
{
IShadowsocksService
,
IShadowsocksServiceCallback
}
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.utils._
import
okhttp3.
{
FormBody
,
OkHttpClient
,
Request
}
import
okhttp3.Dns
import
okhttp3.FormBody
import
okhttp3.OkHttpClient
import
okhttp3.Request
import
okhttp3.Response
class
CustomDns
extends
Dns
{
override
def
lookup
(
hostname
:
String
)
:
List
[
InetAddress
]
=
{
Utils
.
resolve
(
hostname
,
false
)
match
{
case
Some
(
ip
)
=>
Arrays
.
asList
(
InetAddress
.
getByName
(
ip
))
case
_
=>
Dns
.
SYSTEM
.
lookup
(
hostname
)
}
}
}
import
scala.util.Random
trait
BaseService
extends
Service
{
...
...
@@ -166,7 +153,7 @@ trait BaseService extends Service {
val
resposne
=
client
.
newCall
(
request
).
execute
()
val
list
=
resposne
.
body
.
string
val
proxies
=
util
.
Random
.
shuffle
(
list
.
split
(
'|'
).
toSeq
)
val
proxies
=
Random
.
shuffle
(
list
.
split
(
'|'
).
toSeq
)
val
proxy
=
proxies
.
head
.
split
(
':'
)
profile
.
host
=
proxy
(
0
).
trim
profile
.
remotePort
=
proxy
(
1
).
trim
.
toInt
...
...
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