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
238d78cb
Commit
238d78cb
authored
Mar 25, 2022
by
chenhuaqing
Committed by
hanakeichen
Mar 25, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add `proxyRules` field for advanced controlling client behaviors in the VPN service
parent
a9e6bb57
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
10 deletions
+23
-10
app/src/main/java/com/ccwangluo/accelerator/model/Game.kt
app/src/main/java/com/ccwangluo/accelerator/model/Game.kt
+2
-1
app/src/main/java/com/ccwangluo/accelerator/utils/AcceleratorUtils.kt
.../java/com/ccwangluo/accelerator/utils/AcceleratorUtils.kt
+12
-8
core/src/main/java/com/ccnet/acc/AccVpn.kt
core/src/main/java/com/ccnet/acc/AccVpn.kt
+4
-1
core/src/main/java/com/github/shadowsocks/preference/DataStore.kt
.../main/java/com/github/shadowsocks/preference/DataStore.kt
+3
-0
core/src/main/java/com/github/shadowsocks/utils/Constants.kt
core/src/main/java/com/github/shadowsocks/utils/Constants.kt
+2
-0
core/src/main/jniLibs/arm64-v8a/libccnetacc.so
core/src/main/jniLibs/arm64-v8a/libccnetacc.so
+0
-0
core/src/main/jniLibs/armeabi-v7a/libccnetacc.so
core/src/main/jniLibs/armeabi-v7a/libccnetacc.so
+0
-0
No files found.
app/src/main/java/com/ccwangluo/accelerator/model/Game.kt
View file @
238d78cb
...
@@ -16,5 +16,6 @@ data class GameInfo(
...
@@ -16,5 +16,6 @@ data class GameInfo(
val
imgs
:
String
,
val
imgs
:
String
,
val
introduction
:
String
,
val
introduction
:
String
,
val
packageName
:
String
,
val
packageName
:
String
,
val
boosterPackageName
:
String
val
boosterPackageName
:
String
,
val
proxyRules
:
String
,
)
)
\ No newline at end of file
app/src/main/java/com/ccwangluo/accelerator/utils/AcceleratorUtils.kt
View file @
238d78cb
...
@@ -149,14 +149,12 @@ object AcceleratorUtils {
...
@@ -149,14 +149,12 @@ object AcceleratorUtils {
fun
startAccelerator
(
xPageFragment
:
XPageFragment
)
{
fun
startAccelerator
(
xPageFragment
:
XPageFragment
)
{
game
?.
let
{
game
?.
let
{
initAuthProfile
(
xPageFragment
)
initAuthProfile
(
xPageFragment
)
val
serverPort
=
it
.
boosterServer
.
split
(
":"
)
DataStore
.
pingAccHost
=
serverPort
[
0
]
DataStore
.
pingAccPort
=
serverPort
[
1
].
toInt
()
}
}
}
}
private
fun
initAuthProfile
(
xPageFragment
:
XPageFragment
)
{
private
fun
initAuthProfile
(
xPageFragment
:
XPageFragment
)
{
xPageFragment
.
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
xPageFragment
.
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
val
game
=
AcceleratorUtils
.
game
val
profileId
=
1L
val
profileId
=
1L
val
profile
=
ProfileManager
.
getProfile
(
profileId
)
?:
Profile
()
val
profile
=
ProfileManager
.
getProfile
(
profileId
)
?:
Profile
()
profile
.
proxyApps
=
true
profile
.
proxyApps
=
true
...
@@ -167,13 +165,19 @@ object AcceleratorUtils {
...
@@ -167,13 +165,19 @@ object AcceleratorUtils {
"com.activision.callofduty.shooter"
,
"com.activision.callofduty.shooter"
,
"com.pubg.krmobile"
,
"com.pubg.krmobile"
,
)
)
game
?.
packageName
?.
let
{
proxyGames
.
add
(
it
)
}
if
(
game
!=
null
)
{
game
?.
boosterPackageName
?.
split
(
","
)
?.
forEach
{
proxyGames
.
add
(
game
.
packageName
)
if
(!
StringUtils
.
isEmpty
(
it
))
{
game
.
boosterPackageName
.
split
(
","
).
forEach
{
proxyGames
.
add
(
it
)
if
(!
StringUtils
.
isEmpty
(
it
))
{
proxyGames
.
add
(
it
)
}
}
}
DataStore
.
proxyRules
=
game
.
proxyRules
val
serverPort
=
game
.
boosterServer
.
split
(
":"
)
DataStore
.
pingAccHost
=
serverPort
[
0
]
DataStore
.
pingAccPort
=
serverPort
[
1
].
toInt
()
}
}
// proxyGames.addAll(profile.individual.split("\n"))
profile
.
individual
=
proxyGames
.
joinToString
(
"\n"
)
profile
.
individual
=
proxyGames
.
joinToString
(
"\n"
)
profile
.
route
=
Acl
.
BYPASS_LAN
profile
.
route
=
Acl
.
BYPASS_LAN
profile
.
password
=
"barfoo!"
profile
.
password
=
"barfoo!"
...
...
core/src/main/java/com/ccnet/acc/AccVpn.kt
View file @
238d78cb
...
@@ -2,6 +2,7 @@ package com.ccnet.acc
...
@@ -2,6 +2,7 @@ package com.ccnet.acc
import
android.content.Context
import
android.content.Context
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.preference.DataStore
import
timber.log.Timber
import
timber.log.Timber
import
java.io.File
import
java.io.File
...
@@ -14,6 +15,7 @@ object AccVpn {
...
@@ -14,6 +15,7 @@ object AccVpn {
}
}
fun
writeConfig
(
context
:
Context
,
tunFd
:
Int
,
profile
:
Profile
)
{
fun
writeConfig
(
context
:
Context
,
tunFd
:
Int
,
profile
:
Profile
)
{
val
proxyRules
=
DataStore
.
proxyRules
val
configContent
=
"""
val
configContent
=
"""
[General]
[General]
loglevel = trace
loglevel = trace
...
@@ -23,7 +25,8 @@ object AccVpn {
...
@@ -23,7 +25,8 @@ object AccVpn {
Direct = direct
Direct = direct
SS = ss, ${profile.host}, ${profile.remotePort}, encrypt-method=chacha20-ietf-poly1305, password=123456, auth_timeout=${profile.authTimeout}, beats_interval=${profile.beatsInterval}, retry_limit=${profile.retryLimit}, token=${profile.token}
SS = ss, ${profile.host}, ${profile.remotePort}, encrypt-method=chacha20-ietf-poly1305, password=123456, auth_timeout=${profile.authTimeout}, beats_interval=${profile.beatsInterval}, retry_limit=${profile.retryLimit}, token=${profile.token}
[Rule]
[Rule]
FINAL, SS
$proxyRules
FINAL, Direct
"""
"""
val
configFile
=
configFile
(
context
)
val
configFile
=
configFile
(
context
)
Timber
.
d
(
"writeConfig ${configFile.absolutePath}"
)
Timber
.
d
(
"writeConfig ${configFile.absolutePath}"
)
...
...
core/src/main/java/com/github/shadowsocks/preference/DataStore.kt
View file @
238d78cb
...
@@ -131,4 +131,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
...
@@ -131,4 +131,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
var
pingNetReachableHost
:
String
var
pingNetReachableHost
:
String
get
()
=
privateStore
.
getString
(
Key
.
pingNetReachableHost
)
?:
"baidu.com"
get
()
=
privateStore
.
getString
(
Key
.
pingNetReachableHost
)
?:
"baidu.com"
set
(
value
)
=
privateStore
.
putString
(
Key
.
pingNetReachableHost
,
value
)
set
(
value
)
=
privateStore
.
putString
(
Key
.
pingNetReachableHost
,
value
)
var
proxyRules
:
String
get
()
=
privateStore
.
getString
(
Key
.
proxyRules
)
?:
""
set
(
value
)
=
privateStore
.
putString
(
Key
.
proxyRules
,
value
)
}
}
core/src/main/java/com/github/shadowsocks/utils/Constants.kt
View file @
238d78cb
...
@@ -79,6 +79,8 @@ object Key {
...
@@ -79,6 +79,8 @@ object Key {
const
val
pingAccPort
=
"pingAccPort"
const
val
pingAccPort
=
"pingAccPort"
const
val
pingNetReachableHost
=
"pingNetReachableHost"
const
val
pingNetReachableHost
=
"pingNetReachableHost"
const
val
proxyRules
=
"proxyRules"
// TV specific values
// TV specific values
const
val
controlStats
=
"control.stats"
const
val
controlStats
=
"control.stats"
const
val
controlImport
=
"control.import"
const
val
controlImport
=
"control.import"
...
...
core/src/main/jniLibs/arm64-v8a/libccnetacc.so
View file @
238d78cb
No preview for this file type
core/src/main/jniLibs/armeabi-v7a/libccnetacc.so
View file @
238d78cb
No preview for this file type
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