mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-08-23 10:06:48 +08:00
VLESS practice: Use user-sent VLESS UUID's last byte as vlessRoute
for routing
rules
https://github.com/XTLS/Xray-core/pull/5009#issuecomment-3194262087
This commit is contained in:
@@ -33,7 +33,7 @@ func (v *MemoryValidator) Add(u *protocol.MemoryUser) error {
|
||||
return errors.New("User ", u.Email, " already exists.")
|
||||
}
|
||||
}
|
||||
v.users.Store(u.Account.(*MemoryAccount).ID.UUID(), u)
|
||||
v.users.Store([15]byte(u.Account.(*MemoryAccount).ID.Bytes()), u)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -48,13 +48,13 @@ func (v *MemoryValidator) Del(e string) error {
|
||||
return errors.New("User ", e, " not found.")
|
||||
}
|
||||
v.email.Delete(le)
|
||||
v.users.Delete(u.(*protocol.MemoryUser).Account.(*MemoryAccount).ID.UUID())
|
||||
v.users.Delete([15]byte(u.(*protocol.MemoryUser).Account.(*MemoryAccount).ID.Bytes()))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get a VLESS user with UUID, nil if user doesn't exist.
|
||||
func (v *MemoryValidator) Get(id uuid.UUID) *protocol.MemoryUser {
|
||||
u, _ := v.users.Load(id)
|
||||
u, _ := v.users.Load([15]byte(id[:]))
|
||||
if u != nil {
|
||||
return u.(*protocol.MemoryUser)
|
||||
}
|
||||
|
Reference in New Issue
Block a user