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
87b1496f
Commit
87b1496f
authored
May 12, 2021
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle illegal profiles properly
parent
bbc908a5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
+9
-12
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
.../src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
+5
-0
No files found.
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
View file @
87b1496f
...
@@ -221,13 +221,6 @@ object BaseService {
...
@@ -221,13 +221,6 @@ object BaseService {
fun
onBind
(
intent
:
Intent
):
IBinder
?
=
if
(
intent
.
action
==
Action
.
SERVICE
)
data
.
binder
else
null
fun
onBind
(
intent
:
Intent
):
IBinder
?
=
if
(
intent
.
action
==
Action
.
SERVICE
)
data
.
binder
else
null
fun
forceLoad
()
{
fun
forceLoad
()
{
val
(
profile
,
fallback
)
=
Core
.
currentProfile
?:
return
stopRunner
(
false
,
(
this
as
Context
).
getString
(
R
.
string
.
profile_empty
))
if
(
profile
.
host
.
isEmpty
()
||
(!
profile
.
method
.
equals
(
"none"
)
&&
profile
.
password
.
isEmpty
())
||
fallback
!=
null
&&
(
fallback
.
host
.
isEmpty
()
||
(!
fallback
.
method
.
equals
(
"none"
)
&&
fallback
.
password
.
isEmpty
())))
{
stopRunner
(
false
,
(
this
as
Context
).
getString
(
R
.
string
.
proxy_empty
))
return
}
val
s
=
data
.
state
val
s
=
data
.
state
when
{
when
{
s
==
State
.
Stopped
->
startRunner
()
s
==
State
.
Stopped
->
startRunner
()
...
@@ -330,10 +323,14 @@ object BaseService {
...
@@ -330,10 +323,14 @@ object BaseService {
return
Service
.
START_NOT_STICKY
return
Service
.
START_NOT_STICKY
}
}
val
(
profile
,
fallback
)
=
expanded
val
(
profile
,
fallback
)
=
expanded
profile
.
name
=
profile
.
formattedName
// save name for later queries
try
{
val
proxy
=
ProxyInstance
(
profile
)
data
.
proxy
=
ProxyInstance
(
profile
)
data
.
proxy
=
proxy
data
.
udpFallback
=
if
(
fallback
==
null
)
null
else
ProxyInstance
(
fallback
,
profile
.
route
)
data
.
udpFallback
=
if
(
fallback
==
null
)
null
else
ProxyInstance
(
fallback
,
profile
.
route
)
}
catch
(
e
:
IllegalArgumentException
)
{
data
.
notification
=
createNotification
(
""
)
stopRunner
(
false
,
e
.
message
)
return
Service
.
START_NOT_STICKY
}
BootReceiver
.
enabled
=
DataStore
.
persistAcrossReboot
BootReceiver
.
enabled
=
DataStore
.
persistAcrossReboot
if
(!
data
.
closeReceiverRegistered
)
{
if
(!
data
.
closeReceiverRegistered
)
{
...
@@ -369,7 +366,7 @@ object BaseService {
...
@@ -369,7 +366,7 @@ object BaseService {
}
}
startProcesses
()
startProcesses
()
proxy
.
scheduleUpdate
()
data
.
proxy
!!
.
scheduleUpdate
()
data
.
udpFallback
?.
scheduleUpdate
()
data
.
udpFallback
?.
scheduleUpdate
()
data
.
changeState
(
State
.
Connected
)
data
.
changeState
(
State
.
Connected
)
...
...
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
View file @
87b1496f
...
@@ -21,8 +21,10 @@
...
@@ -21,8 +21,10 @@
package
com.github.shadowsocks.bg
package
com.github.shadowsocks.bg
import
android.content.Context
import
android.content.Context
import
com.github.shadowsocks.Core.app
import
com.github.shadowsocks.acl.Acl
import
com.github.shadowsocks.acl.Acl
import
com.github.shadowsocks.acl.AclSyncer
import
com.github.shadowsocks.acl.AclSyncer
import
com.github.shadowsocks.core.R
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.plugin.PluginConfiguration
import
com.github.shadowsocks.plugin.PluginConfiguration
import
com.github.shadowsocks.plugin.PluginManager
import
com.github.shadowsocks.plugin.PluginManager
...
@@ -39,6 +41,9 @@ import java.net.URISyntaxException
...
@@ -39,6 +41,9 @@ import java.net.URISyntaxException
*/
*/
class
ProxyInstance
(
val
profile
:
Profile
,
private
val
route
:
String
=
profile
.
route
)
{
class
ProxyInstance
(
val
profile
:
Profile
,
private
val
route
:
String
=
profile
.
route
)
{
init
{
init
{
require
(
profile
.
host
.
isNotEmpty
()
&&
(
profile
.
method
==
"none"
||
profile
.
password
.
isEmpty
()))
{
app
.
getString
(
R
.
string
.
proxy_empty
)
}
// check the crypto
// check the crypto
require
(
profile
.
method
!
in
arrayOf
(
"aes-192-gcm"
,
"chacha20"
,
"salsa20"
))
{
require
(
profile
.
method
!
in
arrayOf
(
"aes-192-gcm"
,
"chacha20"
,
"salsa20"
))
{
"cipher ${profile.method} is deprecated."
"cipher ${profile.method} is deprecated."
...
...
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