Skip to content
This repository has been archived by the owner on Apr 27, 2020. It is now read-only.

Commit

Permalink
v0.1.5-0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
IrineSistiana committed Feb 15, 2020
1 parent 2f06266 commit 39fa87e
Show file tree
Hide file tree
Showing 24 changed files with 55 additions and 77 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions mostunnel/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "com.github.IrineSistiana.plugin.mostunnel"
minSdkVersion 24
targetSdkVersion 29
versionCode 13
versionName '0.1.3'
versionCode 15
versionName '0.1.5-0.5.0'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
Binary file added mostunnel/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -31,64 +31,52 @@ import kotlin.collections.set

class ConfigFragment : GeneralConfigFragment() {
//required
private val serverName by lazy { findPreference<EditTextPreference>("serverName")!! }

//optional
private val wssMode by lazy { findPreference<CheckBoxPreference>("wssMode")!! }
private val path by lazy { findPreference<EditTextPreference>("path")!! }
private val insecureSkipVerify by lazy { findPreference<CheckBoxPreference>("insecureSkipVerify")!! }
private val n by lazy { findPreference<EditTextPreference>("n")!! }
private val wss by lazy { findPreference<CheckBoxPreference>("wss")!! }
private val wssPath by lazy { findPreference<EditTextPreference>("wss-path")!! }
private val sv by lazy { findPreference<CheckBoxPreference>("sv")!! }
private val mux by lazy { findPreference<CheckBoxPreference>("mux")!! }
private val maxStream by lazy { findPreference<EditTextPreference>("maxStream")!! }
private val muxMaxStream by lazy { findPreference<EditTextPreference>("mux-max-stream")!! }

//geek's
private val buffSize by lazy { findPreference<EditTextPreference>("buffSize")!! }
private val noDelay by lazy { findPreference<CheckBoxPreference>("noDelay")!! }
private val mss by lazy { findPreference<EditTextPreference>("mss")!! }
private val idleTimeout by lazy { findPreference<EditTextPreference>("idleTimeout")!! }
private val timeout by lazy { findPreference<EditTextPreference>("timeout")!! }


//debug
private val receivedStr by lazy { findPreference<Preference>("receivedStr")!! }
private val fallbackDNS by lazy { findPreference<EditTextPreference>("fallbackDNS")!! }
private val fallbackDNS by lazy { findPreference<EditTextPreference>("fallback-dns")!! }
private val verbose by lazy { findPreference<CheckBoxPreference>("verbose")!! }


override val options
get() = PluginOptions().apply {
this.id = "mostlstunnel"
if (serverName.text.isNotBlank()) this["n"] = serverName.text
if (n.text.isNotBlank()) this["n"] = n.text

if (wssMode.isChecked) this["wss"] = null
if (path.text.isNotBlank()) this["path"] = path.text
if (insecureSkipVerify.isChecked) this["sv"] = null
if (wss.isChecked) this["wss"] = null
if (wssPath.text.isNotBlank()) this["wss-path"] = wssPath.text
if (sv.isChecked) this["sv"] = null
if (mux.isChecked) this["mux"] = null
if (maxStream.text.isNotBlank()) this["max-stream"] = maxStream.text

if (buffSize.text.isNotBlank()) this["buff"] = buffSize.text
if (noDelay.isChecked) this["no-delay"] = null
if (mss.text.isNotBlank()) this["mss"] = mss.text
if (muxMaxStream.text.isNotBlank()) this["mux-max-stream"] = muxMaxStream.text

if (idleTimeout.text.isNotBlank()) this["timeout"] = idleTimeout.text
if (timeout.text.isNotBlank()) this["timeout"] = timeout.text

if (fallbackDNS.text.isNotBlank()) this["fallback-dns"] = fallbackDNS.text
if (verbose.isChecked) this["verbose"] = null
}

override fun onInitializePluginOptions(options: PluginOptions) {
serverName.text = options["n"] ?: ""
n.text = options["n"] ?: ""

wssMode.isChecked = options.containsKey("wss")
path.isEnabled = wssMode.isChecked
path.text = options["path"] ?: ""
insecureSkipVerify.isChecked = options.containsKey("sv")
wss.isChecked = options.containsKey("wss")
wssPath.isEnabled = wss.isChecked
wssPath.text = options["wss-path"] ?: ""
sv.isChecked = options.containsKey("sv")
mux.isChecked = options.containsKey("mux")
maxStream.isEnabled = mux.isChecked
maxStream.text = options["max-stream"] ?: ""
muxMaxStream.isEnabled = mux.isChecked
muxMaxStream.text = options["mux-max-stream"] ?: ""

buffSize.text = options["buff"] ?: ""
noDelay.isChecked = options.containsKey("no-delay")
mss.text = options["mss"] ?: ""
idleTimeout.text = options["timeout"] ?: ""
timeout.text = options["timeout"] ?: ""

fallbackDNS.text = options["fallback-dns"] ?: ""
verbose.isChecked = options.containsKey("verbose")
Expand All @@ -97,22 +85,20 @@ class ConfigFragment : GeneralConfigFragment() {

override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
addPreferencesFromResource(R.xml.tls_tunnel_settings)
serverName.setOnBindEditTextListener { it.inputType = InputType.TYPE_TEXT_VARIATION_URI }
n.setOnBindEditTextListener { it.inputType = InputType.TYPE_TEXT_VARIATION_URI }

wssMode.setOnPreferenceChangeListener { _, newValue ->
path.isEnabled = newValue as Boolean
wss.setOnPreferenceChangeListener { _, newValue ->
wssPath.isEnabled = newValue as Boolean
return@setOnPreferenceChangeListener true
}

path.setOnBindEditTextListener { it.inputType = InputType.TYPE_TEXT_VARIATION_URI }
wssPath.setOnBindEditTextListener { it.inputType = InputType.TYPE_TEXT_VARIATION_URI }
mux.setOnPreferenceChangeListener { _, newValue ->
maxStream.isEnabled = newValue as Boolean
muxMaxStream.isEnabled = newValue as Boolean
return@setOnPreferenceChangeListener true
}
maxStream.setOnBindEditTextListener { it.inputType = InputType.TYPE_CLASS_NUMBER }

buffSize.setOnBindEditTextListener { it.inputType = InputType.TYPE_NUMBER_FLAG_DECIMAL }
idleTimeout.setOnBindEditTextListener { it.inputType = InputType.TYPE_NUMBER_FLAG_DECIMAL }
muxMaxStream.setOnBindEditTextListener { it.inputType = InputType.TYPE_CLASS_NUMBER }
timeout.setOnBindEditTextListener { it.inputType = InputType.TYPE_NUMBER_FLAG_DECIMAL }

fallbackDNS.setOnBindEditTextListener { it.inputType = InputType.TYPE_TEXT_VARIATION_URI }
}
Expand Down
4 changes: 2 additions & 2 deletions mostunnel/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
</adaptive-icon>
Binary file modified mostunnel/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mostunnel/src/main/res/mipmap-hdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mostunnel/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mostunnel/src/main/res/mipmap-mdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mostunnel/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mostunnel/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mostunnel/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mostunnel/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mostunnel/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified mostunnel/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions mostunnel/src/main/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#E91E63</color>
</resources>
2 changes: 1 addition & 1 deletion mostunnel/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<string name="app_name">Mos tunnel</string>
<string name="mostlstunnel_plugin_id">mostlstunnel</string>
<string name="mostlstunnel_path_plugin_id">/mostlstunnel</string>
<string name="mostlstunnel_lib_file_name">libmos-tls-tunnel.so</string>
<string name="mostlstunnel_lib_file_name">libmtt-client.so</string>
</resources>
38 changes: 10 additions & 28 deletions mostunnel/src/main/res/xml/tls_tunnel_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
<androidx.preference.PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.preference.PreferenceCategory app:title="Settings">
<androidx.preference.EditTextPreference
app:key="serverName"
app:key="n"
app:persistent="false"
app:title="ServerName (sv)"
app:title="ServerName (n)"
app:useSimpleSummaryProvider="true" />

<androidx.preference.CheckBoxPreference
app:key="wssMode"
app:key="wss"
app:persistent="false"
app:summary="wss"
app:title="Enable WebSocket Protocol" />
<androidx.preference.EditTextPreference
app:key="path"
app:key="wss-path"
app:persistent="false"
app:title="WebSocket Path (path)"
app:title="WebSocket Path (wss-path)"
app:useSimpleSummaryProvider="true" />

<androidx.preference.CheckBoxPreference
app:key="insecureSkipVerify"
app:key="sv"
app:persistent="false"
app:summary="sv"
app:title="Skip Verify" />
Expand All @@ -29,41 +29,23 @@
app:title="Enable mux"
app:summary="mux"/>
<androidx.preference.EditTextPreference
app:key="maxStream"
app:key="mux-max-stream"
app:persistent="false"
app:title="Max number of multiplexed streams (max-stream)"
app:title="Max number of multiplexed streams (mux-max-stream)"
app:useSimpleSummaryProvider="true" />
</androidx.preference.PreferenceCategory>

<androidx.preference.PreferenceCategory app:title="Geek's settings">
<androidx.preference.EditTextPreference
app:key="buffSize"
app:persistent="false"
app:title="IO buffer size (buff)"
app:useSimpleSummaryProvider="true" />

<androidx.preference.CheckBoxPreference
app:key="noDelay"
app:persistent="false"
app:title="Enable TCP no delay"
app:summary="no-delay"/>

<androidx.preference.EditTextPreference
app:key="mss"
app:persistent="false"
app:title="TCP maximum segment size (mss)"
app:useSimpleSummaryProvider="true" />

<androidx.preference.EditTextPreference
app:key="idleTimeout"
app:key="timeout"
app:persistent="false"
app:title="Idle Timeout (timeout)"
app:useSimpleSummaryProvider="true" />
</androidx.preference.PreferenceCategory>

<androidx.preference.PreferenceCategory app:title="Debug only">
<androidx.preference.EditTextPreference
app:key="fallbackDNS"
app:key="fallback-dns"
app:persistent="false"
app:title="Fallback DNS server (fallback-dns)"
app:useSimpleSummaryProvider="true" />
Expand Down

0 comments on commit 39fa87e

Please sign in to comment.