chore: rebuild InboundListener

This commit is contained in:
wwqgtxx
2022-12-04 21:53:13 +08:00
parent 8144373725
commit 62226e8b3d
14 changed files with 138 additions and 96 deletions

View File

@ -2,17 +2,13 @@ package adapter
import (
"fmt"
"strings"
"github.com/Dreamacro/clash/adapter/outbound"
"github.com/Dreamacro/clash/common/structure"
C "github.com/Dreamacro/clash/constant"
)
var keyReplacer = strings.NewReplacer("_", "-")
func ParseProxy(mapping map[string]any) (C.Proxy, error) {
decoder := structure.NewDecoder(structure.Option{TagName: "proxy", WeaklyTypedInput: true, KeyReplacer: keyReplacer})
decoder := structure.NewDecoder(structure.Option{TagName: "proxy", WeaklyTypedInput: true, KeyReplacer: structure.DefaultKeyReplacer})
proxyType, existType := mapping["type"].(string)
if !existType {
return nil, fmt.Errorf("missing type")