You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/proxy/vmess/account_json.go

23 lines
383 B

// +build json
package vmess
import (
"encoding/json"
)
func (u *Account) UnmarshalJSON(data []byte) error {
type JsonConfig struct {
ID string `json:"id"`
AlterIds uint16 `json:"alterId"`
}
var rawConfig JsonConfig
if err := json.Unmarshal(data, &rawConfig); err != nil {
return err
}
u.Id = rawConfig.ID
u.AlterId = uint32(rawConfig.AlterIds)
return nil
}