mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-17 09:56:18 -05:00
23 lines
385 B
Go
23 lines
385 B
Go
// +build json
|
|
|
|
package vmess
|
|
|
|
import (
|
|
"encoding/json"
|
|
)
|
|
|
|
func (u *AccountPB) 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
|
|
}
|