Add routeOnly

This commit is contained in:
2dust
2024-05-02 10:51:54 +08:00
parent f624bd651e
commit e053db3dff
13 changed files with 32 additions and 1 deletions

View File

@@ -15,6 +15,8 @@ object AppConfig {
// Preferences mapped to MMKV
const val PREF_SNIFFING_ENABLED = "pref_sniffing_enabled"
const val PREF_ROUTE_ONLY_ENABLED = "pref_route_only_enabled"
const val PREF_PER_APP_PROXY = "pref_per_app_proxy"
const val PREF_PER_APP_PROXY_SET = "pref_per_app_proxy_set"
const val PREF_BYPASS_APPS = "pref_bypass_apps"

View File

@@ -60,7 +60,8 @@ data class V2rayConfig(
data class SniffingBean(var enabled: Boolean,
val destOverride: ArrayList<String>,
val metadataOnly: Boolean? = null)
val metadataOnly: Boolean? = null,
var routeOnly: Boolean? = null)
}
data class OutboundBean(var tag: String = "proxy",

View File

@@ -230,6 +230,7 @@ class SettingsActivity : BaseActivity() {
}
listOf(
AppConfig.PREF_ROUTE_ONLY_ENABLED,
AppConfig.PREF_BYPASS_APPS,
AppConfig.PREF_SPEED_ENABLED,
AppConfig.PREF_CONFIRM_REMOVE,

View File

@@ -134,6 +134,7 @@ object V2rayConfigUtil {
settingsStorage?.decodeBool(AppConfig.PREF_SNIFFING_ENABLED, true)
?: true
v2rayConfig.inbounds[0].sniffing?.enabled = fakedns || sniffAllTlsAndHttp
v2rayConfig.inbounds[0].sniffing?.routeOnly = settingsStorage?.decodeBool(AppConfig.PREF_ROUTE_ONLY_ENABLED, false)
if (!sniffAllTlsAndHttp) {
v2rayConfig.inbounds[0].sniffing?.destOverride?.clear()
}

View File

@@ -59,6 +59,7 @@ class SettingsViewModel(application: Application) : AndroidViewModel(application
settingsStorage?.encode(key, sharedPreferences.getString(key, ""))
}
AppConfig.PREF_ROUTE_ONLY_ENABLED,
AppConfig.PREF_SPEED_ENABLED,
AppConfig.PREF_PROXY_SHARING,
AppConfig.PREF_LOCAL_DNS_ENABLED,

View File

@@ -125,6 +125,9 @@
<string name="summary_pref_speed_enabled">عرض السرعة الحالية في الإشعار.\nسيتغير رمز الإشعار استنادًا إلى الاستخدام.</string>
<string name="title_pref_sniffing_enabled">تمكين Sniffing</string>
<string name="title_pref_route_only_enabled">Enable routeOnly</string>
<string name="summary_pref_route_only_enabled">Use the sniffed domain name for routing only, and keep the target address as the IP address.</string>
<string name="summary_pref_sniffing_enabled">محاولة استخلاص النطاق من الحزمة (مشغلة افتراضيًا)</string>
<string name="title_pref_local_dns_enabled">تمكين DNS المحلي</string>

View File

@@ -120,6 +120,9 @@
<string name="title_pref_sniffing_enabled">فعال کردن Sniffing</string>
<string name="summary_pref_sniffing_enabled">دامنه sniff را از بسته امتحان کنید (پیش‌فرض روشن)</string>
<string name="title_pref_route_only_enabled">Enable routeOnly</string>
<string name="summary_pref_route_only_enabled">Use the sniffed domain name for routing only, and keep the target address as the IP address.</string>
<string name="title_pref_local_dns_enabled">فعال کردن DNS محلی</string>
<string name="summary_pref_local_dns_enabled">DNS پردازش شده توسط ماژول DNS هسته (توصیه می‌شود، در صورت نیاز به دور زدن LAN و نشانی mainland)</string>

View File

@@ -123,6 +123,9 @@
<string name="title_pref_sniffing_enabled">Анализ пакетов</string>
<string name="summary_pref_sniffing_enabled">Использовать анализ пакетов (по умолчанию включено)</string>
<string name="title_pref_route_only_enabled">Enable routeOnly</string>
<string name="summary_pref_route_only_enabled">Use the sniffed domain name for routing only, and keep the target address as the IP address.</string>
<string name="title_pref_local_dns_enabled">Использовать локальную DNS</string>
<string name="summary_pref_local_dns_enabled">Обслуживание выполняется DNS-модулем ядра (в настройках маршрутизации рекомендуется выбрать режим «Все, кроме LAN и Китая»)</string>

View File

@@ -122,6 +122,9 @@
<string name="title_pref_sniffing_enabled">Bật Sniffing</string>
<string name="summary_pref_sniffing_enabled">Nhận diện tên miền từ gói tin để phục vụ định tuyến. \n(phải tắt để xài Zalo)</string>
<string name="title_pref_route_only_enabled">Enable routeOnly</string>
<string name="summary_pref_route_only_enabled">Use the sniffed domain name for routing only, and keep the target address as the IP address.</string>
<string name="title_pref_local_dns_enabled">Bật Local DNS</string>
<string name="summary_pref_local_dns_enabled">DNS được xử lý bởi mô-đun DNS của xray-core (dùng nếu cần định tuyến bypass cho mạng LAN và địa chỉ nội địa)</string>

View File

@@ -121,6 +121,8 @@
<string name="title_pref_sniffing_enabled">启用流量探测</string>
<string name="summary_pref_sniffing_enabled">从流量中探测域名 (默认启用)</string>
<string name="title_pref_route_only_enabled">启用 routeOnly</string>
<string name="summary_pref_route_only_enabled">将嗅探得到的域名仅用于路由,代理目标地址仍为 IP</string>
<string name="title_pref_local_dns_enabled">启用本地DNS</string>
<string name="summary_pref_local_dns_enabled">DNS 请求导入 core 由 DNS 模块处理(推荐启用 如果需要路由绕过局域网及大陆地址)</string>

View File

@@ -121,6 +121,9 @@
<string name="title_pref_sniffing_enabled">啟用流量監聽</string>
<string name="summary_pref_sniffing_enabled">從流量中監聽網域 (預設啟用)</string>
<string name="title_pref_route_only_enabled">啟用 routeOnly</string>
<string name="summary_pref_route_only_enabled">將嗅探得到的網域只用於路由,代理目標位址仍為 IP</string>
<string name="title_pref_local_dns_enabled">啟用本機 DNS</string>
<string name="summary_pref_local_dns_enabled">DNS 請求匯入 core 由 DNS 模塊處理 (建議啟用,如果需要轉送略過區域網路及中國大陸)</string>

View File

@@ -133,6 +133,8 @@
<string name="title_pref_sniffing_enabled">Enable Sniffing</string>
<string name="summary_pref_sniffing_enabled">Try sniff domain from the packet (default on)</string>
<string name="title_pref_route_only_enabled">Enable routeOnly</string>
<string name="summary_pref_route_only_enabled">Use the sniffed domain name for routing only, and keep the target address as the IP address.</string>
<string name="title_pref_local_dns_enabled">Enable local DNS</string>
<string name="summary_pref_local_dns_enabled">DNS processed by cores DNS module (Recommended, if need routing Bypassing LAN and

View File

@@ -8,6 +8,12 @@
android:summary="@string/summary_pref_sniffing_enabled"
android:title="@string/title_pref_sniffing_enabled" />
<CheckBoxPreference
android:defaultValue="false"
android:key="pref_route_only_enabled"
android:summary="@string/summary_pref_route_only_enabled"
android:title="@string/title_pref_route_only_enabled" />
<PreferenceCategory android:title="@string/title_vpn_settings">
<CheckBoxPreference
android:key="pref_per_app_proxy"