1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-18 01:46:06 -04:00
v2fly/proxy/vmess/account_json.go

23 lines
383 B
Go
Raw Normal View History

2016-07-25 11:36:24 -04:00
// +build json
package vmess
import (
"encoding/json"
)
2016-10-12 12:43:55 -04:00
func (u *Account) UnmarshalJSON(data []byte) error {
2016-07-25 11:36:24 -04:00
type JsonConfig struct {
ID string `json:"id"`
AlterIds uint16 `json:"alterId"`
}
var rawConfig JsonConfig
if err := json.Unmarshal(data, &rawConfig); err != nil {
return err
}
2016-09-17 18:41:21 -04:00
u.Id = rawConfig.ID
u.AlterId = uint32(rawConfig.AlterIds)
2016-07-25 11:36:24 -04:00
return nil
}