mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-12-31 22:45:39 -05:00
fix test break
This commit is contained in:
23
testing/mocks/mockuserset.go
Normal file
23
testing/mocks/mockuserset.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"github.com/v2ray/v2ray-core"
|
||||
)
|
||||
|
||||
type MockUserSet struct {
|
||||
UserIds []core.ID
|
||||
UserHashes map[string]int
|
||||
}
|
||||
|
||||
func (us *MockUserSet) AddUser(user core.User) error {
|
||||
us.UserIds = append(us.UserIds, user.Id)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (us *MockUserSet) GetUser(userhash []byte) (*core.ID, bool) {
|
||||
idx, found := us.UserHashes[string(userhash)]
|
||||
if found {
|
||||
return &us.UserIds[idx], true
|
||||
}
|
||||
return nil, false
|
||||
}
|
||||
Reference in New Issue
Block a user