1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-10-17 08:23:41 -04:00
v2fly/proxy/vmess/protocol/user/testing/mocks/static_userset.go
2016-01-12 11:38:43 +01:00

40 lines
800 B
Go

package mocks
import (
"github.com/v2ray/v2ray-core/common/uuid"
"github.com/v2ray/v2ray-core/proxy/vmess"
"github.com/v2ray/v2ray-core/proxy/vmess/protocol/user"
)
type StaticUser struct {
id *vmess.ID
}
func (this *StaticUser) ID() *vmess.ID {
return this.id
}
func (this *StaticUser) Level() vmess.UserLevel {
return vmess.UserLevelUntrusted
}
func (this *StaticUser) AlterIDs() []*vmess.ID {
return nil
}
func (this *StaticUser) AnyValidID() *vmess.ID {
return this.id
}
type StaticUserSet struct {
}
func (us *StaticUserSet) AddUser(user vmess.User) error {
return nil
}
func (us *StaticUserSet) GetUser(userhash []byte) (vmess.User, user.Timestamp, bool) {
id, _ := uuid.ParseString("703e9102-eb57-499c-8b59-faf4f371bb21")
return &StaticUser{id: vmess.NewID(id)}, 0, true
}