1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-23 02:26:49 -05:00
v2fly/proxy/vmess/account_json.go
2016-10-12 18:43:55 +02:00

23 lines
383 B
Go

// +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
}