mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
528 B
25 lines
528 B
package mocks
|
|
|
|
import (
|
|
"github.com/v2ray/v2ray-core/proxy/vmess/protocol/user"
|
|
)
|
|
|
|
type MockUserSet struct {
|
|
UserIds []user.ID
|
|
UserHashes map[string]int
|
|
Timestamps map[string]int64
|
|
}
|
|
|
|
func (us *MockUserSet) AddUser(user user.User) error {
|
|
us.UserIds = append(us.UserIds, user.Id)
|
|
return nil
|
|
}
|
|
|
|
func (us *MockUserSet) GetUser(userhash []byte) (*user.ID, int64, bool) {
|
|
idx, found := us.UserHashes[string(userhash)]
|
|
if found {
|
|
return &us.UserIds[idx], us.Timestamps[string(userhash)], true
|
|
}
|
|
return nil, 0, false
|
|
}
|