1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-06 09:15:37 -05:00

Introduce user level

This commit is contained in:
V2Ray
2015-10-31 00:38:31 +01:00
parent d585ec0593
commit b44098d752
6 changed files with 58 additions and 20 deletions

View File

@@ -5,20 +5,20 @@ import (
)
type MockUserSet struct {
UserIds []*config.ID
Users []config.User
UserHashes map[string]int
Timestamps map[string]int64
}
func (us *MockUserSet) AddUser(user config.User) error {
us.UserIds = append(us.UserIds, user.ID())
us.Users = append(us.Users, user)
return nil
}
func (us *MockUserSet) GetUser(userhash []byte) (*config.ID, int64, bool) {
func (us *MockUserSet) GetUser(userhash []byte) (config.User, int64, bool) {
idx, found := us.UserHashes[string(userhash)]
if found {
return us.UserIds[idx], us.Timestamps[string(userhash)], true
return us.Users[idx], us.Timestamps[string(userhash)], true
}
return nil, 0, false
}