static_userset.go 799 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package mocks
  2. import (
  3. "github.com/v2ray/v2ray-core/common/uuid"
  4. "github.com/v2ray/v2ray-core/proxy/vmess"
  5. "github.com/v2ray/v2ray-core/proxy/vmess/protocol"
  6. )
  7. type StaticUser struct {
  8. id *vmess.ID
  9. }
  10. func (this *StaticUser) ID() *vmess.ID {
  11. return this.id
  12. }
  13. func (this *StaticUser) Level() vmess.UserLevel {
  14. return vmess.UserLevelUntrusted
  15. }
  16. func (this *StaticUser) AlterIDs() []*vmess.ID {
  17. return nil
  18. }
  19. func (this *StaticUser) AnyValidID() *vmess.ID {
  20. return this.id
  21. }
  22. type StaticUserSet struct {
  23. }
  24. func (us *StaticUserSet) AddUser(user vmess.User) error {
  25. return nil
  26. }
  27. func (us *StaticUserSet) GetUser(userhash []byte) (vmess.User, protocol.Timestamp, bool) {
  28. id, _ := uuid.ParseString("703e9102-eb57-499c-8b59-faf4f371bb21")
  29. return &StaticUser{id: vmess.NewID(id)}, 0, true
  30. }