mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-19 14:40:06 +08:00
update settings
This commit is contained in:
parent
2743fcb3f2
commit
6be1fd0d6f
@ -98,7 +98,7 @@ object DataStore : OnPreferenceDataStoreChangeListener {
|
|||||||
var showGroupInNotification by configurationStore.boolean("showGroupInNotification")
|
var showGroupInNotification by configurationStore.boolean("showGroupInNotification")
|
||||||
|
|
||||||
var remoteDns by configurationStore.string(Key.REMOTE_DNS) { "https://dns.google/dns-query" }
|
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 enableDnsRouting by configurationStore.boolean(Key.ENABLE_DNS_ROUTING) { true }
|
||||||
var enableFakeDns by configurationStore.boolean(Key.ENABLE_FAKEDNS)
|
var enableFakeDns by configurationStore.boolean(Key.ENABLE_FAKEDNS)
|
||||||
|
|
||||||
|
|||||||
@ -48,7 +48,6 @@ const val TAG_DNS_IN = "dns-in"
|
|||||||
const val TAG_DNS_OUT = "dns-out"
|
const val TAG_DNS_OUT = "dns-out"
|
||||||
|
|
||||||
const val LOCALHOST = "127.0.0.1"
|
const val LOCALHOST = "127.0.0.1"
|
||||||
const val LOCAL_DNS_SERVER = "local"
|
|
||||||
|
|
||||||
class ConfigBuildResult(
|
class ConfigBuildResult(
|
||||||
var config: String,
|
var config: String,
|
||||||
@ -697,7 +696,7 @@ fun buildConfig(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
dns.servers.add(DNSServerOptions().apply {
|
dns.servers.add(DNSServerOptions().apply {
|
||||||
address = LOCAL_DNS_SERVER
|
address = "local"
|
||||||
tag = "dns-local"
|
tag = "dns-local"
|
||||||
detour = TAG_DIRECT
|
detour = TAG_DIRECT
|
||||||
})
|
})
|
||||||
@ -714,14 +713,8 @@ fun buildConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (forTest) {
|
if (forTest) {
|
||||||
// Always use system DNS for urlTest
|
// Always use direct DNS for urlTest
|
||||||
dns.servers = listOf(
|
dns.servers.removeAt(0)
|
||||||
DNSServerOptions().apply {
|
|
||||||
address = LOCAL_DNS_SERVER
|
|
||||||
tag = "dns-local"
|
|
||||||
detour = TAG_DIRECT
|
|
||||||
}
|
|
||||||
)
|
|
||||||
dns.rules = listOf()
|
dns.rules = listOf()
|
||||||
} else {
|
} else {
|
||||||
// built-in DNS rules
|
// built-in DNS rules
|
||||||
@ -732,7 +725,7 @@ fun buildConfig(
|
|||||||
route.rules.add(0, Rule_DefaultOptions().apply {
|
route.rules.add(0, Rule_DefaultOptions().apply {
|
||||||
port = listOf(53)
|
port = listOf(53)
|
||||||
outbound = TAG_DNS_OUT
|
outbound = TAG_DNS_OUT
|
||||||
}) // TODO new mode use system dns?
|
})
|
||||||
if (DataStore.bypassLanInCore) {
|
if (DataStore.bypassLanInCore) {
|
||||||
route.rules.add(Rule_DefaultOptions().apply {
|
route.rules.add(Rule_DefaultOptions().apply {
|
||||||
outbound = TAG_BYPASS
|
outbound = TAG_BYPASS
|
||||||
|
|||||||
@ -14,7 +14,7 @@ public abstract class StandardV2RayBean extends AbstractBean {
|
|||||||
|
|
||||||
//////// End of VMess & VLESS ////////
|
//////// 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 type;
|
||||||
|
|
||||||
public String host;
|
public String host;
|
||||||
|
|||||||
@ -593,12 +593,6 @@ fun buildSingBoxOutboundStreamSettings(bean: StandardV2RayBean): V2RayTransportO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (needKeepAliveInterval) {
|
|
||||||
// sockopt = StreamSettingsObject.SockoptObject().apply {
|
|
||||||
// tcpKeepAliveInterval = keepAliveInterval
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -286,6 +286,7 @@ object RawUpdater : GroupUpdater() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
"vmess", "vless" -> {
|
"vmess", "vless" -> {
|
||||||
|
var isHttpUpgrade = false
|
||||||
val isVLESS = proxy["type"].toString() == "vless"
|
val isVLESS = proxy["type"].toString() == "vless"
|
||||||
val bean = VMessBean().apply {
|
val bean = VMessBean().apply {
|
||||||
if (isVLESS) {
|
if (isVLESS) {
|
||||||
@ -366,6 +367,10 @@ object RawUpdater : GroupUpdater() {
|
|||||||
"early-data-header-name" -> {
|
"early-data-header-name" -> {
|
||||||
bean.earlyDataHeaderName = wsOpt.value.toString()
|
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)
|
proxies.add(bean)
|
||||||
}
|
}
|
||||||
|
|
||||||
"trojan" -> {
|
"trojan" -> {
|
||||||
|
var isHttpUpgrade = false
|
||||||
val bean = TrojanBean()
|
val bean = TrojanBean()
|
||||||
bean.security = "tls"
|
bean.security = "tls"
|
||||||
for (opt in proxy) {
|
for (opt in proxy) {
|
||||||
@ -451,6 +460,10 @@ object RawUpdater : GroupUpdater() {
|
|||||||
"path" -> {
|
"path" -> {
|
||||||
bean.path = wsOpt.value.toString()
|
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)
|
proxies.add(bean)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,13 +43,13 @@ class LogcatFragment : ToolbarFragment(R.layout.layout_logcat),
|
|||||||
private fun getColorForLine(line: String): ForegroundColorSpan {
|
private fun getColorForLine(line: String): ForegroundColorSpan {
|
||||||
var color = ForegroundColorSpan(Color.GRAY)
|
var color = ForegroundColorSpan(Color.GRAY)
|
||||||
when {
|
when {
|
||||||
line.contains(" INFO[") || line.contains(" [Info]") -> {
|
line.contains("INFO[") || line.contains(" [Info]") -> {
|
||||||
color = ForegroundColorSpan((0xFF86C166).toInt())
|
color = ForegroundColorSpan((0xFF86C166).toInt())
|
||||||
}
|
}
|
||||||
line.contains(" ERROR[") || line.contains(" [Error]") -> {
|
line.contains("ERROR[") || line.contains(" [Error]") -> {
|
||||||
color = ForegroundColorSpan(Color.RED)
|
color = ForegroundColorSpan(Color.RED)
|
||||||
}
|
}
|
||||||
line.contains(" WARN[") || line.contains(" [Warning]") -> {
|
line.contains("WARN[") || line.contains(" [Warning]") -> {
|
||||||
color = ForegroundColorSpan(Color.RED)
|
color = ForegroundColorSpan(Color.RED)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,21 +8,21 @@ import moe.matsuri.nb4a.SingBoxOptions.RuleSet
|
|||||||
object SingBoxOptionsUtil {
|
object SingBoxOptionsUtil {
|
||||||
|
|
||||||
fun domainStrategy(tag: String): String {
|
fun domainStrategy(tag: String): String {
|
||||||
fun auto2AsIs(key: String): String {
|
fun auto2(key: String, newS: String): String {
|
||||||
return (DataStore.configurationStore.getString(key) ?: "").replace("auto", "")
|
return (DataStore.configurationStore.getString(key) ?: "").replace("auto", newS)
|
||||||
}
|
}
|
||||||
return when (tag) {
|
return when (tag) {
|
||||||
"dns-remote" -> {
|
"dns-remote" -> {
|
||||||
auto2AsIs("domain_strategy_for_remote")
|
auto2("domain_strategy_for_remote", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
"dns-direct" -> {
|
"dns-direct" -> {
|
||||||
auto2AsIs("domain_strategy_for_direct")
|
auto2("domain_strategy_for_direct", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// server
|
// server
|
||||||
else -> {
|
else -> {
|
||||||
auto2AsIs("domain_strategy_for_server")
|
auto2("domain_strategy_for_server", "prefer_ipv4")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -263,7 +263,7 @@
|
|||||||
<item>http</item>
|
<item>http</item>
|
||||||
<item>quic</item>
|
<item>quic</item>
|
||||||
<item>grpc</item>
|
<item>grpc</item>
|
||||||
<!-- <item>httpupgrade</item>-->
|
<item>httpupgrade</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="trojan_go_networks_entry">
|
<string-array name="trojan_go_networks_entry">
|
||||||
|
|||||||
@ -177,7 +177,7 @@
|
|||||||
app:title="@string/domain_strategy_for_remote"
|
app:title="@string/domain_strategy_for_remote"
|
||||||
app:useSimpleSummaryProvider="true" />
|
app:useSimpleSummaryProvider="true" />
|
||||||
<EditTextPreference
|
<EditTextPreference
|
||||||
app:defaultValue="local"
|
app:defaultValue="https://120.53.53.53/dns-query"
|
||||||
app:icon="@drawable/ic_action_dns"
|
app:icon="@drawable/ic_action_dns"
|
||||||
app:key="directDns"
|
app:key="directDns"
|
||||||
app:title="@string/direct_dns"
|
app:title="@string/direct_dns"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user