From b176492d55329e307de57ddb3fa6ee8587bb2aeb Mon Sep 17 00:00:00 2001 From: mzz2017 Date: Fri, 19 Aug 2022 22:23:19 +0800 Subject: [PATCH] feat(vmess): fuzzily parse allowInsecure --- service/core/serverObj/v2ray.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/service/core/serverObj/v2ray.go b/service/core/serverObj/v2ray.go index 89154f26..540b4464 100644 --- a/service/core/serverObj/v2ray.go +++ b/service/core/serverObj/v2ray.go @@ -3,6 +3,8 @@ package serverObj import ( "encoding/base64" "fmt" + "github.com/tidwall/gjson" + "github.com/tidwall/sjson" "github.com/v2rayA/v2rayA/common/ntp" "net" "net/url" @@ -167,6 +169,12 @@ func ParseVmessURL(vmess string) (data *V2Ray, err error) { info.Net = "ws" } } else { + // fuzzily parse allowInsecure + if allowInsecure := gjson.Get(raw, "allowInsecure"); allowInsecure.Exists() { + if newRaw, err := sjson.Set(raw, "allowInsecure", allowInsecure.Bool()); err == nil { + raw = newRaw + } + } err = jsoniter.Unmarshal([]byte(raw), &info) if err != nil { return