mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-18 23:00:12 +00:00
handle switch account command in vmess out
This commit is contained in:
1 parent
b0adb24003
commit
baaef1dad5
12 files changed
+251
-50
No files matched your search
@@ -12,7 +12,7 @@ func (u *User) UnmarshalJSON(data []byte) error {
|
||||
type rawUser struct {
|
||||
IdString string `json:"id"`
|
||||
EmailString string `json:"email"`
|
||||
LevelInt int `json:"level"`
|
||||
LevelByte byte `json:"level"`
|
||||
AlterIdCount uint16 `json:"alterId"`
|
||||
}
|
||||
var rawUserValue rawUser
|
||||
@@ -23,20 +23,7 @@ func (u *User) UnmarshalJSON(data []byte) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
u.ID = NewID(id)
|
||||
//u.Email = rawUserValue.EmailString
|
||||
u.Level = UserLevel(rawUserValue.LevelInt)
|
||||
|
||||
if rawUserValue.AlterIdCount > 0 {
|
||||
prevId := u.ID.UUID()
|
||||
// TODO: check duplicate
|
||||
u.AlterIDs = make([]*ID, rawUserValue.AlterIdCount)
|
||||
for idx, _ := range u.AlterIDs {
|
||||
newid := prevId.Next()
|
||||
u.AlterIDs[idx] = NewID(newid)
|
||||
prevId = newid
|
||||
}
|
||||
}
|
||||
*u = *NewUser(NewID(id), UserLevel(rawUserValue.LevelByte), rawUserValue.AlterIdCount)
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user