update settings

This commit is contained in:
armv9 2024-10-09 13:21:53 +09:00
parent 2743fcb3f2
commit 6be1fd0d6f
9 changed files with 32 additions and 29 deletions

View File

@ -98,7 +98,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
var showGroupInNotification by configurationStore.boolean("showGroupInNotification")
var remoteDns by configurationStore.string(Key.REMOTE_DNS) { "https://dns.google/dns-query" }
var directDns by configurationStore.string(Key.DIRECT_DNS) { "local" }
var directDns by configurationStore.string(Key.DIRECT_DNS) { "https://120.53.53.53/dns-query" }
var enableDnsRouting by configurationStore.boolean(Key.ENABLE_DNS_ROUTING) { true }
var enableFakeDns by configurationStore.boolean(Key.ENABLE_FAKEDNS)

View File

@ -48,7 +48,6 @@ const val TAG_DNS_IN = "dns-in"
const val TAG_DNS_OUT = "dns-out"
const val LOCALHOST = "127.0.0.1"
const val LOCAL_DNS_SERVER = "local"
class ConfigBuildResult(
var config: String,
@ -697,7 +696,7 @@ fun buildConfig(
})
}
dns.servers.add(DNSServerOptions().apply {
address = LOCAL_DNS_SERVER
address = "local"
tag = "dns-local"
detour = TAG_DIRECT
})
@ -714,14 +713,8 @@ fun buildConfig(
}
if (forTest) {
// Always use system DNS for urlTest
dns.servers = listOf(
DNSServerOptions().apply {
address = LOCAL_DNS_SERVER
tag = "dns-local"
detour = TAG_DIRECT
}
)
// Always use direct DNS for urlTest
dns.servers.removeAt(0)
dns.rules = listOf()
} else {
// built-in DNS rules
@ -732,7 +725,7 @@ fun buildConfig(
route.rules.add(0, Rule_DefaultOptions().apply {
port = listOf(53)
outbound = TAG_DNS_OUT
}) // TODO new mode use system dns?
})
if (DataStore.bypassLanInCore) {
route.rules.add(Rule_DefaultOptions().apply {
outbound = TAG_BYPASS

View File

@ -14,7 +14,7 @@ public abstract class StandardV2RayBean extends AbstractBean {
//////// End of VMess & VLESS ////////
// "V2Ray Transport" tcp/http/ws/quic/grpc/httpUpgrade
// "V2Ray Transport" tcp/http/ws/quic/grpc/httpupgrade
public String type;
public String host;

View File

@ -593,12 +593,6 @@ fun buildSingBoxOutboundStreamSettings(bean: StandardV2RayBean): V2RayTransportO
}
}
// if (needKeepAliveInterval) {
// sockopt = StreamSettingsObject.SockoptObject().apply {
// tcpKeepAliveInterval = keepAliveInterval
// }
// }
return null
}

View File

@ -286,6 +286,7 @@ object RawUpdater : GroupUpdater() {
}
"vmess", "vless" -> {
var isHttpUpgrade = false
val isVLESS = proxy["type"].toString() == "vless"
val bean = VMessBean().apply {
if (isVLESS) {
@ -366,6 +367,10 @@ object RawUpdater : GroupUpdater() {
"early-data-header-name" -> {
bean.earlyDataHeaderName = wsOpt.value.toString()
}
"v2ray-http-upgrade" -> {
isHttpUpgrade = true
}
}
}
@ -411,10 +416,14 @@ object RawUpdater : GroupUpdater() {
}
}
}
if (isHttpUpgrade) {
bean.type = "httpupgrade"
}
proxies.add(bean)
}
"trojan" -> {
var isHttpUpgrade = false
val bean = TrojanBean()
bean.security = "tls"
for (opt in proxy) {
@ -451,6 +460,10 @@ object RawUpdater : GroupUpdater() {
"path" -> {
bean.path = wsOpt.value.toString()
}
"v2ray-http-upgrade" -> {
isHttpUpgrade = true
}
}
}
@ -462,6 +475,9 @@ object RawUpdater : GroupUpdater() {
}
}
}
if (isHttpUpgrade) {
bean.type = "httpupgrade"
}
proxies.add(bean)
}

View File

@ -43,13 +43,13 @@ class LogcatFragment : ToolbarFragment(R.layout.layout_logcat),
private fun getColorForLine(line: String): ForegroundColorSpan {
var color = ForegroundColorSpan(Color.GRAY)
when {
line.contains(" INFO[") || line.contains(" [Info]") -> {
line.contains("INFO[") || line.contains(" [Info]") -> {
color = ForegroundColorSpan((0xFF86C166).toInt())
}
line.contains(" ERROR[") || line.contains(" [Error]") -> {
line.contains("ERROR[") || line.contains(" [Error]") -> {
color = ForegroundColorSpan(Color.RED)
}
line.contains(" WARN[") || line.contains(" [Warning]") -> {
line.contains("WARN[") || line.contains(" [Warning]") -> {
color = ForegroundColorSpan(Color.RED)
}
}

View File

@ -8,21 +8,21 @@ import moe.matsuri.nb4a.SingBoxOptions.RuleSet
object SingBoxOptionsUtil {
fun domainStrategy(tag: String): String {
fun auto2AsIs(key: String): String {
return (DataStore.configurationStore.getString(key) ?: "").replace("auto", "")
fun auto2(key: String, newS: String): String {
return (DataStore.configurationStore.getString(key) ?: "").replace("auto", newS)
}
return when (tag) {
"dns-remote" -> {
auto2AsIs("domain_strategy_for_remote")
auto2("domain_strategy_for_remote", "")
}
"dns-direct" -> {
auto2AsIs("domain_strategy_for_direct")
auto2("domain_strategy_for_direct", "")
}
// server
else -> {
auto2AsIs("domain_strategy_for_server")
auto2("domain_strategy_for_server", "prefer_ipv4")
}
}
}

View File

@ -263,7 +263,7 @@
<item>http</item>
<item>quic</item>
<item>grpc</item>
<!-- <item>httpupgrade</item>-->
<item>httpupgrade</item>
</string-array>
<string-array name="trojan_go_networks_entry">

View File

@ -177,7 +177,7 @@
app:title="@string/domain_strategy_for_remote"
app:useSimpleSummaryProvider="true" />
<EditTextPreference
app:defaultValue="local"
app:defaultValue="https://120.53.53.53/dns-query"
app:icon="@drawable/ic_action_dns"
app:key="directDns"
app:title="@string/direct_dns"