Fix ConfigBuilder

This commit is contained in:
arm64v8a 2023-05-16 09:35:45 +09:00
parent 29a5914e8b
commit b65333b1c6

View File

@ -336,13 +336,6 @@ fun buildConfig(
bypassDNSBeans += proxyEntity.requireBean()
}
if (needGlobal) {
globalOutbounds[proxyEntity.id]?.let {
if (index == 0) chainTagOut = it // single, duplicate chain
return@forEachIndexed
}
}
// last profile set as "proxy"
if (chainId == 0L && index == 0) {
tagOut = TAG_PROXY
@ -353,10 +346,6 @@ fun buildConfig(
tagOut = selectorName(bean.displayName())
}
// now tagOut is determined
if (needGlobal) {
globalOutbounds[proxyEntity.id] = tagOut
}
// chain rules
if (index > 0) {
@ -374,6 +363,15 @@ fun buildConfig(
chainTagOut = tagOut
}
// now tagOut is determined
if (needGlobal) {
globalOutbounds[proxyEntity.id]?.let {
if (index == 0) chainTagOut = it // single, duplicate chain
return@forEachIndexed
}
globalOutbounds[proxyEntity.id] = tagOut
}
// Chain outbound
if (proxyEntity.needExternal()) {
val localPort = mkPort()
@ -465,8 +463,8 @@ fun buildConfig(
}
if (Plugins.isUsingMatsuriExe(pluginId)) {
needExternal = false
} else if (bean is HysteriaBean) {
throw Exception("not supported hysteria-plugin (SagerNet)")
} else if (pluginId.isNotBlank()) {
throw Exception("You are using an unsupported $pluginId, please download the correct plugin.")
}
}
if (needExternal) {