chore: clear config field name (be compatible with old field name)

This commit is contained in:
wwqgtxx
2022-11-26 21:35:47 +08:00
parent ae76daf393
commit 495fd191f2
5 changed files with 67 additions and 70 deletions

View File

@ -2,6 +2,7 @@ package adapter
import (
"fmt"
"strings"
"github.com/Dreamacro/clash/adapter/outbound"
"github.com/Dreamacro/clash/common/structure"
@ -9,6 +10,12 @@ import (
)
func ParseProxy(mapping map[string]any) (C.Proxy, error) {
newMapping := make(map[string]any)
for key := range mapping {
newMapping[strings.ReplaceAll(key, "_", "-")] = mapping[key]
}
mapping = newMapping
decoder := structure.NewDecoder(structure.Option{TagName: "proxy", WeaklyTypedInput: true})
proxyType, existType := mapping["type"].(string)
if !existType {