diff --git a/proxy/vmess/config/json/outbound.go b/proxy/vmess/config/json/outbound.go index f5aa0f4b..6feae011 100644 --- a/proxy/vmess/config/json/outbound.go +++ b/proxy/vmess/config/json/outbound.go @@ -44,15 +44,20 @@ type Outbound struct { TargetList []*ConfigTarget `json:"vnext"` } -func (this *Outbound) UnmarshallJSON(data []byte) error { - err := json.Unmarshal(data, this) +func (this *Outbound) UnmarshalJSON(data []byte) error { + type RawOutbound struct { + TargetList []*ConfigTarget `json:"vnext"` + } + rawOutbound := &RawOutbound{} + err := json.Unmarshal(data, rawOutbound) if err != nil { return err } - if len(this.TargetList) == 0 { + if len(rawOutbound.TargetList) == 0 { log.Error("0 VMess receiver configured.") return proxyconfig.BadConfiguration } + this.TargetList = rawOutbound.TargetList return nil }