mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 20:52:15 +08:00
fix: Converter SIP002 parameters parse (#976)
This commit is contained in:
parent
460cc240b0
commit
36ea09eff4
@ -68,7 +68,8 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
|
|||||||
hysteria["skip-cert-verify"], _ = strconv.ParseBool(query.Get("insecure"))
|
hysteria["skip-cert-verify"], _ = strconv.ParseBool(query.Get("insecure"))
|
||||||
|
|
||||||
proxies = append(proxies, hysteria)
|
proxies = append(proxies, hysteria)
|
||||||
case "hysteria2":
|
|
||||||
|
case "hysteria2", "hy2":
|
||||||
urlHysteria2, err := url.Parse(line)
|
urlHysteria2, err := url.Parse(line)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
continue
|
continue
|
||||||
@ -79,7 +80,7 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
|
|||||||
hysteria2 := make(map[string]any, 20)
|
hysteria2 := make(map[string]any, 20)
|
||||||
|
|
||||||
hysteria2["name"] = name
|
hysteria2["name"] = name
|
||||||
hysteria2["type"] = scheme
|
hysteria2["type"] = "hysteria2"
|
||||||
hysteria2["server"] = urlHysteria2.Hostname()
|
hysteria2["server"] = urlHysteria2.Hostname()
|
||||||
if port := urlHysteria2.Port(); port != "" {
|
if port := urlHysteria2.Port(); port != "" {
|
||||||
hysteria2["port"] = port
|
hysteria2["port"] = port
|
||||||
@ -101,6 +102,7 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
|
|||||||
hysteria2["up"] = query.Get("up")
|
hysteria2["up"] = query.Get("up")
|
||||||
|
|
||||||
proxies = append(proxies, hysteria2)
|
proxies = append(proxies, hysteria2)
|
||||||
|
|
||||||
case "tuic":
|
case "tuic":
|
||||||
// A temporary unofficial TUIC share link standard
|
// A temporary unofficial TUIC share link standard
|
||||||
// Modified from https://github.com/daeuniverse/dae/discussions/182
|
// Modified from https://github.com/daeuniverse/dae/discussions/182
|
||||||
@ -405,14 +407,27 @@ func ConvertsV2Ray(buf []byte) ([]map[string]any, error) {
|
|||||||
if query.Get("udp-over-tcp") == "true" || query.Get("uot") == "1" {
|
if query.Get("udp-over-tcp") == "true" || query.Get("uot") == "1" {
|
||||||
ss["udp-over-tcp"] = true
|
ss["udp-over-tcp"] = true
|
||||||
}
|
}
|
||||||
if strings.Contains(query.Get("plugin"), "obfs") {
|
plugin := query.Get("plugin")
|
||||||
obfsParams := strings.Split(query.Get("plugin"), ";")
|
if strings.Contains(plugin, ";") {
|
||||||
ss["plugin"] = "obfs"
|
pluginInfo, _ := url.ParseQuery("pluginName=" + strings.ReplaceAll(plugin, ";", "&"))
|
||||||
ss["plugin-opts"] = map[string]any{
|
pluginName := pluginInfo.Get("pluginName")
|
||||||
"host": obfsParams[2][10:],
|
if strings.Contains(pluginName, "obfs") {
|
||||||
"mode": obfsParams[1][5:],
|
ss["plugin"] = "obfs"
|
||||||
|
ss["plugin-opts"] = map[string]any{
|
||||||
|
"mode": pluginInfo.Get("obfs"),
|
||||||
|
"host": pluginInfo.Get("obfs-host"),
|
||||||
|
}
|
||||||
|
} else if strings.Contains(pluginName, "v2ray-plugin") {
|
||||||
|
ss["plugin"] = "v2ray-plugin"
|
||||||
|
ss["plugin-opts"] = map[string]any{
|
||||||
|
"mode": pluginInfo.Get("mode"),
|
||||||
|
"host": pluginInfo.Get("host"),
|
||||||
|
"path": pluginInfo.Get("path"),
|
||||||
|
"tls": strings.Contains(plugin, "tls"),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proxies = append(proxies, ss)
|
proxies = append(proxies, ss)
|
||||||
|
|
||||||
case "ssr":
|
case "ssr":
|
||||||
|
Loading…
Reference in New Issue
Block a user