fix: resolve some configuration parsing issues

This commit is contained in:
Restia-Ashbell 2025-04-13 19:51:29 +08:00 committed by armv9
parent 98c3534ae5
commit 0ffa4d0bdd
3 changed files with 6 additions and 14 deletions

View File

@ -81,7 +81,7 @@ public abstract class StandardV2RayBean extends AbstractBean {
if (JavaUtil.isNullOrBlank(path)) path = ""; if (JavaUtil.isNullOrBlank(path)) path = "";
if (JavaUtil.isNullOrBlank(security)) { if (JavaUtil.isNullOrBlank(security)) {
if (this instanceof TrojanBean || isVLESS()) { if (this instanceof TrojanBean) {
security = "tls"; security = "tls";
} else { } else {
security = "none"; security = "none";

View File

@ -153,7 +153,7 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
} }
type = url.queryParameter("type") ?: "tcp" type = url.queryParameter("type") ?: "tcp"
if (type == "h2") type = "http" if (type == "h2" || url.queryParameter("headerType") == "http") type = "http"
security = url.queryParameter("security") security = url.queryParameter("security")
if (security.isNullOrBlank()) { if (security.isNullOrBlank()) {
@ -163,6 +163,9 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
when (security) { when (security) {
"tls", "reality" -> { "tls", "reality" -> {
security = "tls" security = "tls"
url.queryParameter("allowInsecure")?.let {
allowInsecure = it == "1" || it == "true"
}
url.queryParameter("sni")?.let { url.queryParameter("sni")?.let {
sni = it sni = it
} }
@ -185,16 +188,6 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
} }
when (type) { when (type) {
"tcp" -> {
// v2rayNG
if (url.queryParameter("headerType") == "http") {
url.queryParameter("host")?.let {
type = "http"
host = it
}
}
}
"http" -> { "http" -> {
url.queryParameter("host")?.let { url.queryParameter("host")?.let {
host = it host = it

View File

@ -251,7 +251,7 @@ object RawUpdater : GroupUpdater() {
setTLS(proxy["tls"]?.toString() == "true") setTLS(proxy["tls"]?.toString() == "true")
sni = proxy["sni"]?.toString() sni = proxy["sni"]?.toString()
name = proxy["name"]?.toString() name = proxy["name"]?.toString()
allowInsecure = proxy["name"]?.toString() == "true" allowInsecure = proxy["skip-cert-verify"]?.toString() == "true"
}) })
} }
@ -296,7 +296,6 @@ object RawUpdater : GroupUpdater() {
"vless" -> VMessBean().apply { "vless" -> VMessBean().apply {
alterId = -1 // make it VLESS alterId = -1 // make it VLESS
packetEncoding = 2 // clash meta default XUDP packetEncoding = 2 // clash meta default XUDP
security = "tls"
} }
"trojan" -> TrojanBean().apply { "trojan" -> TrojanBean().apply {