mirror of
https://github.com/MatsuriDayo/NekoBoxForAndroid.git
synced 2025-12-19 22:50:05 +08:00
Subscription: parse sing-box outbound
This commit is contained in:
parent
89c1dab989
commit
4483a85df2
@ -760,9 +760,25 @@ object RawUpdater : GroupUpdater() {
|
||||
}
|
||||
|
||||
json.has("outbounds") -> {
|
||||
return listOf(ConfigBean().applyDefaultValues().apply {
|
||||
config = json.toStringPretty()
|
||||
})
|
||||
return json.getJSONArray("outbounds")
|
||||
.filterIsInstance<JSONObject>()
|
||||
.mapNotNull {
|
||||
val ty = it.getStr("type")
|
||||
if (ty == null || ty == "" ||
|
||||
ty == "dns" || ty == "block" || ty == "direct" || ty == "selector" || ty == "urltest"
|
||||
) {
|
||||
null
|
||||
} else {
|
||||
it
|
||||
}
|
||||
}.map {
|
||||
ConfigBean().apply {
|
||||
applyDefaultValues()
|
||||
type = 1
|
||||
config = it.toStringPretty()
|
||||
name = it.getStr("tag")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
json.has("server") && json.has("server_port") -> {
|
||||
|
||||
@ -6,6 +6,7 @@ import io.nekohasekai.sagernet.database.ProxyEntity.Companion.TYPE_NEKO
|
||||
import io.nekohasekai.sagernet.fmt.AbstractBean
|
||||
import io.nekohasekai.sagernet.ktx.app
|
||||
import io.nekohasekai.sagernet.ktx.getColorAttr
|
||||
import moe.matsuri.nb4a.proxy.config.ConfigBean
|
||||
|
||||
// Settings for all protocols, built-in or plugin
|
||||
object Protocols {
|
||||
@ -17,6 +18,9 @@ object Protocols {
|
||||
) {
|
||||
|
||||
fun hash(): String {
|
||||
if (bean is ConfigBean) {
|
||||
return bean.config
|
||||
}
|
||||
return bean.serverAddress + bean.serverPort + type
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user