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
576ab96c
Commit
576ab96c
authored
Mar 29, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into preference-1.1
parents
76dee1cf
1fb8589f
Changes
19
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
54 additions
and
43 deletions
+54
-43
.gitmodules
.gitmodules
+1
-1
build.gradle
build.gradle
+1
-1
core/build.gradle
core/build.gradle
+2
-2
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
+0
-5
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
.../src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
+7
-1
core/src/main/java/com/github/shadowsocks/bg/RemoteConfig.kt
core/src/main/java/com/github/shadowsocks/bg/RemoteConfig.kt
+20
-8
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
+1
-4
core/src/main/java/com/github/shadowsocks/database/Profile.kt
.../src/main/java/com/github/shadowsocks/database/Profile.kt
+1
-1
core/src/main/java/com/github/shadowsocks/net/LocalDnsServer.kt
...rc/main/java/com/github/shadowsocks/net/LocalDnsServer.kt
+1
-1
core/src/main/jni/Android.mk
core/src/main/jni/Android.mk
+1
-1
core/src/main/jni/badvpn
core/src/main/jni/badvpn
+1
-1
core/src/main/jni/libev
core/src/main/jni/libev
+1
-1
core/src/main/jni/libsodium
core/src/main/jni/libsodium
+1
-1
core/src/main/jni/mbedtls
core/src/main/jni/mbedtls
+1
-1
core/src/main/jni/redsocks
core/src/main/jni/redsocks
+1
-1
core/src/main/jni/shadowsocks-libev
core/src/main/jni/shadowsocks-libev
+1
-1
mobile/src/main/java/com/github/shadowsocks/UdpFallbackProfileActivity.kt
...java/com/github/shadowsocks/UdpFallbackProfileActivity.kt
+2
-1
mobile/src/main/res/xml/pref_profile.xml
mobile/src/main/res/xml/pref_profile.xml
+10
-10
plugin/build.gradle
plugin/build.gradle
+1
-1
No files found.
.gitmodules
View file @
576ab96c
...
...
@@ -29,4 +29,4 @@
branch = stable
[submodule "core/src/main/jni/libev"]
path = core/src/main/jni/libev
url = https://git
hub.com/shadowsocks
/libev.git
url = https://git
.lighttpd.net
/libev.git
build.gradle
View file @
576ab96c
...
...
@@ -30,7 +30,7 @@ buildscript {
classpath
'com.github.ben-manes:gradle-versions-plugin:0.21.0'
classpath
'com.google.gms:google-services:4.2.0'
classpath
'com.vanniktech:gradle-maven-publish-plugin:0.8.0'
classpath
'io.fabric.tools:gradle:1.2
7
.1'
classpath
'io.fabric.tools:gradle:1.2
8
.1'
classpath
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
...
...
core/build.gradle
View file @
576ab96c
...
...
@@ -54,8 +54,8 @@ dependencies {
api
'androidx.preference:preference:1.1.0-alpha04'
api
"androidx.room:room-runtime:$roomVersion"
api
'com.crashlytics.sdk.android:crashlytics:2.9.9'
api
'com.google.firebase:firebase-config:16.
1.3
'
api
'com.google.firebase:firebase-core:16.0.
7
'
api
'com.google.firebase:firebase-config:16.
4.1
'
api
'com.google.firebase:firebase-core:16.0.
8
'
api
'dnsjava:dnsjava:2.1.8'
api
'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1'
api
'org.connectbot.jsocks:jsocks:1.0.0'
...
...
core/src/main/java/com/github/shadowsocks/bg/BaseService.kt
View file @
576ab96c
...
...
@@ -90,10 +90,6 @@ object BaseService {
binder
.
stateChanged
(
s
,
msg
)
state
=
s
}
init
{
RemoteConfig
.
fetch
()
}
}
class
Binder
(
private
var
data
:
Data
?
=
null
)
:
IShadowsocksService
.
Stub
(),
AutoCloseable
{
...
...
@@ -341,7 +337,6 @@ object BaseService {
proxy
.
scheduleUpdate
()
data
.
udpFallback
?.
scheduleUpdate
()
RemoteConfig
.
fetch
()
data
.
changeState
(
State
.
Connected
)
}
catch
(
_
:
CancellationException
)
{
...
...
core/src/main/java/com/github/shadowsocks/bg/ProxyInstance.kt
View file @
576ab96c
...
...
@@ -40,6 +40,7 @@ import kotlinx.coroutines.*
import
java.io.File
import
java.io.IOException
import
java.net.HttpURLConnection
import
java.net.URL
import
java.net.UnknownHostException
import
java.security.MessageDigest
...
...
@@ -51,12 +52,16 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
var
trafficMonitor
:
TrafficMonitor
?
=
null
private
val
plugin
=
PluginConfiguration
(
profile
.
plugin
?:
""
).
selectedOptions
val
pluginPath
by
lazy
{
PluginManager
.
init
(
plugin
)
}
private
var
scheduleConfigUpdate
=
false
suspend
fun
init
(
service
:
BaseService
.
Interface
)
{
if
(
profile
.
host
==
"198.199.101.152"
)
{
scheduleConfigUpdate
=
true
val
mdg
=
MessageDigest
.
getInstance
(
"SHA-1"
)
mdg
.
update
(
Core
.
packageInfo
.
signaturesCompat
.
first
().
toByteArray
())
val
conn
=
service
.
openConnection
(
RemoteConfig
.
proxyUrl
)
as
HttpURLConnection
val
(
config
,
success
)
=
RemoteConfig
.
fetch
()
scheduleConfigUpdate
=
!
success
val
conn
=
service
.
openConnection
(
URL
(
config
.
getString
(
"proxy_url"
)))
as
HttpURLConnection
conn
.
requestMethod
=
"POST"
conn
.
doOutput
=
true
...
...
@@ -134,6 +139,7 @@ class ProxyInstance(val profile: Profile, private val route: String = profile.ro
fun
scheduleUpdate
()
{
if
(
route
!
in
arrayOf
(
Acl
.
ALL
,
Acl
.
CUSTOM_RULES
))
AclSyncer
.
schedule
(
route
)
if
(
scheduleConfigUpdate
)
RemoteConfig
.
scheduleFetch
()
}
fun
shutdown
(
scope
:
CoroutineScope
)
{
...
...
core/src/main/java/com/github/shadowsocks/bg/RemoteConfig.kt
View file @
576ab96c
...
...
@@ -25,18 +25,30 @@ import androidx.core.os.bundleOf
import
com.github.shadowsocks.Core
import
com.github.shadowsocks.core.R
import
com.google.firebase.remoteconfig.FirebaseRemoteConfig
import
java.net.URL
import
kotlinx.coroutines.suspendCancellableCoroutine
import
kotlin.coroutines.resume
object
RemoteConfig
{
private
val
config
=
FirebaseRemoteConfig
.
getInstance
().
apply
{
setDefaults
(
R
.
xml
.
default_configs
)
}
private
val
config
by
lazy
{
FirebaseRemoteConfig
.
getInstance
().
apply
{
setDefaults
(
R
.
xml
.
default_configs
)
}
}
val
proxyUrl
get
()
=
URL
(
config
.
getString
(
"proxy_url"
))
private
fun
Exception
.
log
()
{
Log
.
w
(
"RemoteConfig"
,
this
)
Core
.
analytics
.
logEvent
(
"femote_config_failure"
,
bundleOf
(
Pair
(
javaClass
.
simpleName
,
message
)))
}
fun
scheduleFetch
()
=
config
.
fetch
().
addOnCompleteListener
{
if
(
it
.
isSuccessful
)
config
.
activateFetched
()
else
it
.
exception
?.
log
()
}
fun
fetch
()
=
config
.
fetch
().
addOnCompleteListener
{
if
(
it
.
isSuccessful
)
config
.
activateFetched
()
else
{
val
e
=
it
.
exception
?:
return
@addOnCompleteListener
Log
.
w
(
"RemoteConfig"
,
e
)
Core
.
analytics
.
logEvent
(
"femote_config_failure"
,
bundleOf
(
Pair
(
e
.
javaClass
.
simpleName
,
e
.
message
)))
suspend
fun
fetch
()
=
suspendCancellableCoroutine
<
Pair
<
FirebaseRemoteConfig
,
Boolean
>>
{
cont
->
config
.
fetch
().
addOnCompleteListener
{
if
(
it
.
isSuccessful
)
{
config
.
activateFetched
()
cont
.
resume
(
config
to
true
)
}
else
{
it
.
exception
?.
log
()
cont
.
resume
(
config
to
false
)
}
}
}
}
core/src/main/java/com/github/shadowsocks/bg/VpnService.kt
View file @
576ab96c
...
...
@@ -199,17 +199,14 @@ class VpnService : BaseVpnService(), LocalDnsService.Interface {
val
conn
=
builder
.
establish
()
?:
throw
NullConnectionException
()
this
.
conn
=
conn
val
fd
=
conn
.
fd
val
cmd
=
arrayListOf
(
File
(
applicationInfo
.
nativeLibraryDir
,
Executable
.
TUN2SOCKS
).
absolutePath
,
"--netif-ipaddr"
,
PRIVATE_VLAN4_ROUTER
,
"--netif-netmask"
,
"255.255.255.0"
,
"--socks-server-addr"
,
"${DataStore.listenAddress}:${DataStore.portProxy}"
,
"--tunfd"
,
fd
.
toString
(),
"--tunmtu"
,
VPN_MTU
.
toString
(),
"--sock-path"
,
"sock_path"
,
"--dnsgw"
,
"127.0.0.1:${DataStore.portLocalDns}"
,
"--loglevel"
,
"
3
"
)
"--loglevel"
,
"
warning
"
)
if
(
profile
.
ipv6
)
{
cmd
+=
"--netif-ip6addr"
cmd
+=
PRIVATE_VLAN6_ROUTER
...
...
core/src/main/java/com/github/shadowsocks/database/Profile.kt
View file @
576ab96c
...
...
@@ -54,7 +54,7 @@ data class Profile(
var
password
:
String
=
"u1rRWTssNv0p"
,
var
method
:
String
=
"aes-256-cfb"
,
var
route
:
String
=
"all"
,
var
remoteDns
:
String
=
"
8.8.8.8
"
,
var
remoteDns
:
String
=
"
dns.google
"
,
var
proxyApps
:
Boolean
=
false
,
var
bypass
:
Boolean
=
false
,
var
udpdns
:
Boolean
=
false
,
...
...
core/src/main/java/com/github/shadowsocks/net/LocalDnsServer.kt
View file @
576ab96c
...
...
@@ -89,7 +89,7 @@ class LocalDnsServer(private val localResolver: suspend (String) -> Array<InetAd
private
val
job
=
SupervisorJob
()
override
val
coroutineContext
=
job
+
CoroutineExceptionHandler
{
_
,
t
->
printLog
(
t
)
}
suspend
fun
start
(
listen
:
SocketAddress
)
=
DatagramChannel
.
open
().
apply
{
suspend
fun
start
(
listen
:
SocketAddress
)
=
DatagramChannel
.
open
().
run
{
configureBlocking
(
false
)
socket
().
bind
(
listen
)
monitor
.
register
(
this
,
SelectionKey
.
OP_READ
)
{
handlePacket
(
this
)
}
...
...
core/src/main/jni/Android.mk
View file @
576ab96c
...
...
@@ -114,7 +114,7 @@ include $(CLEAR_VARS)
LIBEVENT_SOURCES
:=
\
buffer.c bufferevent.c event.c
\
bufferevent_sock.c bufferevent_ratelim.c
\
evthread.c log.c evutil.c evutil_time.c evmap.c epoll.c poll.c signal.c
select
.c
evthread.c log.c evutil.c evutil_
rand.c evutil_
time.c evmap.c epoll.c poll.c signal.c
select
.c
LOCAL_MODULE
:=
event
LOCAL_SRC_FILES
:=
$(
addprefix
libevent/,
$(LIBEVENT_SOURCES)
)
...
...
badvpn
@
e8660cfa
Subproject commit
ba4c45d6b4d30fd6b2557e92a770ccae12ec9257
Subproject commit
e8660cfae85762d3d3eaf72c47b8478f1c9f0e22
libev
@
31ca40b7
Subproject commit
5213419011ec5de302f8bc1716f348de1fb53b12
Subproject commit
31ca40b7a18ed424213a4ecba0d57706ed3e56a0
libsodium
@
b732443c
Subproject commit
fec4c92d81189e0394ad94e14f238a837c81385e
Subproject commit
b732443c442239c2e0184820e9b23cca0de0828c
mbedtls
@
9f4f8eec
Subproject commit
4f0929189ab43e020b0d441919abf6bab02baf11
Subproject commit
9f4f8eec93dd1f32d78e0bcceddbef0ca570e66f
redsocks
@
d9954892
Subproject commit
274334f14839431ae003774d99c3d1de337afff4
Subproject commit
d9954892ba96627748efab2901f38d7e20d6d0a2
shadowsocks-libev
@
b0c6ba49
Subproject commit b
430124ed82973d4edf345dfadbe556f93377484
Subproject commit b
0c6ba494509473e269f7ae5b5e769e09bb9b6ee
mobile/src/main/java/com/github/shadowsocks/UdpFallbackProfileActivity.kt
View file @
576ab96c
...
...
@@ -33,6 +33,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
com.github.shadowsocks.database.Profile
import
com.github.shadowsocks.database.ProfileManager
import
com.github.shadowsocks.plugin.PluginConfiguration
import
com.github.shadowsocks.preference.DataStore
import
com.github.shadowsocks.utils.resolveResourceId
...
...
@@ -61,7 +62,7 @@ class UdpFallbackProfileActivity : AppCompatActivity() {
inner
class
ProfilesAdapter
:
RecyclerView
.
Adapter
<
ProfileViewHolder
>()
{
internal
val
profiles
=
(
ProfileManager
.
getAllProfiles
()
?.
toMutableList
()
?:
mutableListOf
())
.
filter
{
it
.
id
!=
editingId
&&
it
.
plugin
.
isNullOr
Empty
()
}
.
filter
{
it
.
id
!=
editingId
&&
PluginConfiguration
(
it
.
plugin
?:
""
).
selected
.
is
Empty
()
}
override
fun
onBindViewHolder
(
holder
:
ProfileViewHolder
,
position
:
Int
)
=
holder
.
bind
(
if
(
position
==
0
)
null
else
profiles
[
position
-
1
])
...
...
mobile/src/main/res/xml/pref_profile.xml
View file @
576ab96c
...
...
@@ -42,11 +42,6 @@
app:entryValues=
"@array/route_value"
app:title=
"@string/route_list"
app:useSimpleSummaryProvider=
"true"
/>
<EditTextPreference
app:key=
"remoteDns"
app:icon=
"@drawable/ic_action_dns"
app:title=
"@string/remote_dns"
app:useSimpleSummaryProvider=
"true"
/>
<SwitchPreference
app:key=
"isIpv6"
app:icon=
"@drawable/ic_image_looks_6"
...
...
@@ -57,16 +52,21 @@
app:icon=
"@drawable/ic_navigation_apps"
app:summary=
"@string/proxied_apps_summary"
app:title=
"@string/proxied_apps"
/>
<SwitchPreference
app:key=
"isUdpDns"
app:icon=
"@drawable/ic_action_dns"
app:summary=
"@string/udp_dns_summary"
app:title=
"@string/udp_dns"
/>
<SwitchPreference
app:key=
"metered"
app:icon=
"@drawable/ic_device_data_usage"
app:summary=
"@string/metered_summary"
app:title=
"@string/metered"
/>
<EditTextPreference
app:key=
"remoteDns"
app:icon=
"@drawable/ic_action_dns"
app:title=
"@string/remote_dns"
app:useSimpleSummaryProvider=
"true"
/>
<SwitchPreference
app:key=
"isUdpDns"
app:icon=
"@drawable/ic_action_dns"
app:summary=
"@string/udp_dns_summary"
app:title=
"@string/udp_dns"
/>
</PreferenceCategory>
...
...
plugin/build.gradle
View file @
576ab96c
...
...
@@ -50,7 +50,7 @@ mavenPublish {
dependencies
{
api
'androidx.core:core-ktx:1.0.1'
api
'com.google.android.material:material:1.1.0-alpha0
4
'
api
'com.google.android.material:material:1.1.0-alpha0
5
'
api
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion"
testImplementation
"junit:junit:$junitVersion"
androidTestImplementation
"androidx.test:runner:$androidTestVersion"
...
...
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