Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b57be669c | ||
|
|
2f051e9eed | ||
|
|
8d1d018fe1 | ||
|
|
3c5bc27750 | ||
|
|
6c047eca8e | ||
|
|
a31e753841 |
+1
-1
Submodule kcptun/go updated: 70f0438db8...c3f75e654d
+1
-1
Submodule kcptun/kcptun updated: 9afbc4985d...69c4702115
+1
-1
@@ -51,7 +51,7 @@ export PATH=$GOROOT/bin:$PATH
|
||||
pushd kcptun/client
|
||||
|
||||
echo "Get dependences for kcptun"
|
||||
go get -u github.com/madeye/kcp-go
|
||||
go get -u github.com/xtaci/kcp-go
|
||||
go get
|
||||
|
||||
echo "Cross compile kcptun for arm"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools" package="com.github.shadowsocks"
|
||||
android:versionCode="147"
|
||||
android:versionName="3.0.5">
|
||||
android:versionCode="148"
|
||||
android:versionName="3.0.6">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.content.{Intent, SharedPreferences}
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.preference.{Preference, PreferenceFragment, SwitchPreference}
|
||||
import android.support.design.widget.Snackbar
|
||||
import android.support.v7.app.AlertDialog
|
||||
import android.webkit.{WebView, WebViewClient}
|
||||
import com.github.shadowsocks.ShadowsocksApplication.app
|
||||
@@ -158,7 +159,9 @@ class ShadowsocksSettings extends PreferenceFragment with OnSharedPreferenceChan
|
||||
tfo.setChecked(TcpFastOpen.sendEnabled)
|
||||
tfo.setOnPreferenceChangeListener((_, v) => {
|
||||
val value = v.asInstanceOf[Boolean]
|
||||
TcpFastOpen.enabled(value)
|
||||
val result = TcpFastOpen.enabled(value)
|
||||
if (result != null && result != "Success.")
|
||||
Snackbar.make(activity.findViewById(android.R.id.content), result, Snackbar.LENGTH_LONG).show()
|
||||
value == TcpFastOpen.sendEnabled
|
||||
})
|
||||
if (!TcpFastOpen.supported) {
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.io.File
|
||||
|
||||
import eu.chainfire.libsuperuser.Shell
|
||||
|
||||
import scala.collection.JavaConverters._
|
||||
|
||||
/**
|
||||
* @author Mygod
|
||||
*/
|
||||
@@ -26,11 +28,23 @@ object TcpFastOpen {
|
||||
file.canRead && (Utils.readAllLines(file).toInt & 1) > 0
|
||||
}
|
||||
|
||||
def enabled(value: Boolean) = if (supported) {
|
||||
val fastopen = "echo " + (if (value) 3 else 0) + " > /proc/sys/net/ipv4/tcp_fastopen"
|
||||
Shell.SU.run(Array(
|
||||
"mount -o remount,rw /system && " + fastopen + " && echo '#!/system/bin/sh\n" + fastopen +
|
||||
"' > /etc/init.d/tcp_fastopen && chmod 755 /etc/init.d/tcp_fastopen",
|
||||
"mount -o remount,ro /system"))
|
||||
}
|
||||
def enabled(value: Boolean) =
|
||||
Shell.run("su", Array(
|
||||
"if echo " + (if (value) 3 else 0) + " > /proc/sys/net/ipv4/tcp_fastopen; then",
|
||||
" success=-1",
|
||||
" if mount -o rw,remount /dev/block/platform/msm_sdcc.1/by-name/system /system; then",
|
||||
if (value) " echo '#!/system/bin/sh\n" +
|
||||
"echo 3 > /proc/sys/net/ipv4/tcp_fastopen' > /etc/init.d/tcp_fastopen && chmod 755 /etc/init.d/tcp_fastopen"
|
||||
else "rm -f /etc/init.d/tcp_fastopen",
|
||||
" success=$?",
|
||||
" mount -o ro,remount /dev/block/platform/msm_sdcc.1/by-name/system /system",
|
||||
" fi",
|
||||
" if [ $success -eq 0 ]; then",
|
||||
" echo Success.",
|
||||
" else",
|
||||
" echo Warning: Unable to create boot script.",
|
||||
" fi",
|
||||
"else",
|
||||
" echo Failed.",
|
||||
"fi"), null, true).asScala.mkString("\n")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user