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
009dcb11
Unverified
Commit
009dcb11
authored
May 08, 2021
by
Mygod
Committed by
GitHub
May 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve server name dynamically always (#2731)
Fixes #2722.
parent
7b3e4cec
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
1 addition
and
23 deletions
+1
-23
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
+0
-6
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
.../src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
+0
-14
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
+0
-1
core/src/main/res/values/strings.xml
core/src/main/res/values/strings.xml
+0
-1
core/src/main/rust/shadowsocks-rust
core/src/main/rust/shadowsocks-rust
+1
-1
No files found.
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
View file @
009dcb11
...
...
@@ -50,7 +50,6 @@ import timber.log.Timber
import
java.io.File
import
java.io.IOException
import
java.net.URL
import
java.net.UnknownHostException
/**
* This object uses WeakMap to simulate the effects of multi-inheritance.
...
...
@@ -316,7 +315,6 @@ object BaseService {
listOfNotNull
(
data
.
proxy
,
data
.
udpFallback
).
forEach
{
it
.
trafficMonitor
?.
persistStats
(
it
.
profile
.
id
)
}
suspend
fun
preInit
()
{
}
suspend
fun
resolver
(
host
:
String
)
=
DnsResolverCompat
.
resolveOnActiveNetwork
(
host
)
suspend
fun
rawResolver
(
query
:
ByteArray
)
=
DnsResolverCompat
.
resolveRawOnActiveNetwork
(
query
)
suspend
fun
openConnection
(
url
:
URL
)
=
url
.
openConnection
()
...
...
@@ -355,8 +353,6 @@ object BaseService {
try
{
Executable
.
killAll
()
// clean up old processes
preInit
()
proxy
.
init
(
this
@Interface
)
data
.
udpFallback
?.
init
(
this
@Interface
)
if
(
profile
.
route
==
Acl
.
CUSTOM_RULES
)
try
{
withContext
(
Dispatchers
.
IO
)
{
Acl
.
customRules
.
flatten
(
10
,
this
@Interface
::
openConnection
).
also
{
...
...
@@ -379,8 +375,6 @@ object BaseService {
data
.
changeState
(
State
.
Connected
)
}
catch
(
_
:
CancellationException
)
{
// if the job was cancelled, it is canceller's responsibility to call stopRunner
}
catch
(
_
:
UnknownHostException
)
{
stopRunner
(
false
,
getString
(
R
.
string
.
invalid_server
))
}
catch
(
exc
:
Throwable
)
{
if
(
exc
is
ExpectedException
)
Timber
.
d
(
exc
)
else
Timber
.
w
(
exc
)
stopRunner
(
false
,
"${getString(R.string.service_failed)}: ${exc.readableMessage}"
)
...
...
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
View file @
009dcb11
...
...
@@ -27,15 +27,12 @@ import com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.plugin.PluginConfiguration
import
com.github.shadowsocks.plugin.PluginManager
import
com.github.shadowsocks.preference.DataStore
import
com.github.shadowsocks.utils.parseNumericAddress
import
kotlinx.coroutines.CoroutineScope
import
org.json.JSONArray
import
org.json.JSONObject
import
java.io.File
import
java.io.IOException
import
java.net.URI
import
java.net.URISyntaxException
import
java.net.UnknownHostException
/**
* This class sets up environment for ss-local.
...
...
@@ -51,17 +48,6 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
var
trafficMonitor
:
TrafficMonitor
?
=
null
val
plugin
by
lazy
{
PluginManager
.
init
(
PluginConfiguration
(
profile
.
plugin
?:
""
))
}
suspend
fun
init
(
service
:
BaseService
.
Interface
)
{
// it's hard to resolve DNS on a specific interface so we'll do it here
if
(
plugin
!=
null
&&
profile
.
host
.
parseNumericAddress
()
==
null
)
{
profile
.
host
=
try
{
service
.
resolver
(
profile
.
host
).
firstOrNull
()
}
catch
(
e
:
IOException
)
{
throw
UnknownHostException
().
initCause
(
e
)
}
?.
hostAddress
?:
throw
UnknownHostException
()
}
}
/**
* Sensitive shadowsocks configuration file requires extra protection. It may be stored in encrypted storage or
* device storage, depending on which is currently available.
...
...
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
View file @
009dcb11
...
...
@@ -146,7 +146,6 @@ class VpnService : BaseVpnService(), BaseService.Interface {
}
override
suspend
fun
preInit
()
=
DefaultNetworkListener
.
start
(
this
)
{
underlyingNetwork
=
it
}
override
suspend
fun
resolver
(
host
:
String
)
=
DnsResolverCompat
.
resolve
(
DefaultNetworkListener
.
get
(),
host
)
override
suspend
fun
rawResolver
(
query
:
ByteArray
)
=
// no need to listen for network here as this is only used for forwarding local DNS queries.
// retries should be attempted by client.
...
...
core/src/main/res/values/strings.xml
View file @
009dcb11
...
...
@@ -69,7 +69,6 @@
<string
name=
"service_proxy"
>
Proxy Service
</string>
<string
name=
"service_transproxy"
>
Transproxy Service
</string>
<string
name=
"forward_success"
>
Shadowsocks started.
</string>
<string
name=
"invalid_server"
>
Invalid server name
</string>
<string
name=
"service_failed"
>
Failed to connect the remote server
</string>
<string
name=
"stop"
>
Stop
</string>
<string
name=
"stopping"
>
Shutting down…
</string>
...
...
shadowsocks-rust
@
7342501a
Subproject commit
9977eb724e6d257e6a570b788d91d70b432a49e0
Subproject commit
7342501a737115c32c2f2eaa516a4e7b3a3385d9
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