add allowInsecure support

This commit is contained in:
yiguo
2023-09-26 09:18:08 +08:00
parent d62fb2e0d9
commit 19cfe711bb
3 changed files with 21 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ import (
"strings"
)
// https://github.com/XTLS/Xray-core/discussions/716
// Convert share text to XrayJson
// support XrayJson, v2rayN plain text, v2rayN base64 text, Clash yaml, Clash.Meta yaml
func ConvertShareTextToXrayJson(textPath string, xrayPath string) string {
@@ -488,6 +489,17 @@ func (proxy xrayShareLink) parseSecurity(link *url.URL, streamSettings *XrayStre
tlsSettings.Alpn = strings.Split(alpn, ",")
}
// https://github.com/XTLS/Xray-core/discussions/716
// 4.4.3 allowInsecure
// 没有这个字段。不安全的节点,不适合分享。
// I don't like this field, but too many people ask for it.
allowInsecure := query.Get("allowInsecure")
if len(allowInsecure) > 0 {
if allowInsecure == "true" || allowInsecure == "1" {
tlsSettings.AllowInsecure = true
}
}
pbk := query.Get("pbk")
realitySettings.PublicKey = pbk
sid := query.Get("sid")

View File

@@ -323,6 +323,14 @@ func (proxy XrayOutbound) streamSettingsQuery(link *url.URL) {
if len(alpn) > 0 {
query = addQuery(query, "alpn", strings.Join(alpn, ","))
}
// https://github.com/XTLS/Xray-core/discussions/716
// 4.4.3 allowInsecure
// 没有这个字段。不安全的节点,不适合分享。
// I don't like this field, but too many people ask for it.
allowInsecure := streamSettings.TlsSettings.AllowInsecure
if allowInsecure {
query = addQuery(query, "allowInsecure", "1")
}
case "reality":
if streamSettings.RealitySettings == nil {
break

View File

@@ -7,6 +7,7 @@ import (
"strings"
)
// https://github.com/2dust/v2rayN/wiki/%E5%88%86%E4%BA%AB%E9%93%BE%E6%8E%A5%E6%A0%BC%E5%BC%8F%E8%AF%B4%E6%98%8E(ver-2)
type vmessQrCode struct {
Ps string `json:"ps,omitempty"`
Add string `json:"add,omitempty"`