Skip to content

Commit 0ffa4d0

Browse files
Restia-Ashbellarm64v8a
authored andcommitted
fix: resolve some configuration parsing issues
1 parent 98c3534 commit 0ffa4d0

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/StandardV2RayBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public void initializeDefaultValues() {
8181
if (JavaUtil.isNullOrBlank(path)) path = "";
8282

8383
if (JavaUtil.isNullOrBlank(security)) {
84-
if (this instanceof TrojanBean || isVLESS()) {
84+
if (this instanceof TrojanBean) {
8585
security = "tls";
8686
} else {
8787
security = "none";

app/src/main/java/io/nekohasekai/sagernet/fmt/v2ray/V2RayFmt.kt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
153153
}
154154

155155
type = url.queryParameter("type") ?: "tcp"
156-
if (type == "h2") type = "http"
156+
if (type == "h2" || url.queryParameter("headerType") == "http") type = "http"
157157

158158
security = url.queryParameter("security")
159159
if (security.isNullOrBlank()) {
@@ -163,6 +163,9 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
163163
when (security) {
164164
"tls", "reality" -> {
165165
security = "tls"
166+
url.queryParameter("allowInsecure")?.let {
167+
allowInsecure = it == "1" || it == "true"
168+
}
166169
url.queryParameter("sni")?.let {
167170
sni = it
168171
}
@@ -185,16 +188,6 @@ fun StandardV2RayBean.parseDuckSoft(url: HttpUrl) {
185188
}
186189

187190
when (type) {
188-
"tcp" -> {
189-
// v2rayNG
190-
if (url.queryParameter("headerType") == "http") {
191-
url.queryParameter("host")?.let {
192-
type = "http"
193-
host = it
194-
}
195-
}
196-
}
197-
198191
"http" -> {
199192
url.queryParameter("host")?.let {
200193
host = it

app/src/main/java/io/nekohasekai/sagernet/group/RawUpdater.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ object RawUpdater : GroupUpdater() {
251251
setTLS(proxy["tls"]?.toString() == "true")
252252
sni = proxy["sni"]?.toString()
253253
name = proxy["name"]?.toString()
254-
allowInsecure = proxy["name"]?.toString() == "true"
254+
allowInsecure = proxy["skip-cert-verify"]?.toString() == "true"
255255
})
256256
}
257257

@@ -296,7 +296,6 @@ object RawUpdater : GroupUpdater() {
296296
"vless" -> VMessBean().apply {
297297
alterId = -1 // make it VLESS
298298
packetEncoding = 2 // clash meta default XUDP
299-
security = "tls"
300299
}
301300

302301
"trojan" -> TrojanBean().apply {

0 commit comments

Comments
 (0)