mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
fix: Converter panic on bad VMess share links
This commit is contained in:
parent
e745755a46
commit
836615aac9
@ -9,10 +9,12 @@ const BufferSize = buf.BufferSize
|
||||
|
||||
type Buffer = buf.Buffer
|
||||
|
||||
var New = buf.New
|
||||
var StackNew = buf.StackNew
|
||||
var StackNewSize = buf.StackNewSize
|
||||
var With = buf.With
|
||||
var (
|
||||
New = buf.New
|
||||
StackNew = buf.StackNew
|
||||
StackNewSize = buf.StackNewSize
|
||||
With = buf.With
|
||||
)
|
||||
|
||||
var KeepAlive = common.KeepAlive
|
||||
|
||||
@ -21,5 +23,7 @@ func Dup[T any](obj T) T {
|
||||
return common.Dup(obj)
|
||||
}
|
||||
|
||||
var Must = common.Must
|
||||
var Error = common.Error
|
||||
var (
|
||||
Must = common.Must
|
||||
Error = common.Error
|
||||
)
|
||||
|
@ -5,10 +5,11 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/Dreamacro/clash/log"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/Dreamacro/clash/log"
|
||||
)
|
||||
|
||||
// ConvertsV2Ray convert V2Ray subscribe proxies data to clash proxies config
|
||||
@ -201,7 +202,8 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
|
||||
vmess["servername"] = sni
|
||||
}
|
||||
|
||||
network := strings.ToLower(values["net"].(string))
|
||||
network, _ := values["net"].(string)
|
||||
network = strings.ToLower(network)
|
||||
if values["type"] == "http" {
|
||||
network = "http"
|
||||
} else if network == "http" {
|
||||
@ -209,9 +211,12 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
|
||||
}
|
||||
vmess["network"] = network
|
||||
|
||||
tls := strings.ToLower(values["tls"].(string))
|
||||
if strings.HasSuffix(tls, "tls") {
|
||||
vmess["tls"] = true
|
||||
tls, ok := values["tls"].(string)
|
||||
if ok {
|
||||
tls = strings.ToLower(tls)
|
||||
if strings.HasSuffix(tls, "tls") {
|
||||
vmess["tls"] = true
|
||||
}
|
||||
}
|
||||
|
||||
switch network {
|
||||
|
Loading…
Reference in New Issue
Block a user