mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-07-13 04:30:13 -04:00
re-org vmess content
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"github.com/v2ray/v2ray-core/proxy/vmess/config"
|
||||
"github.com/v2ray/v2ray-core/proxy/vmess"
|
||||
)
|
||||
|
||||
type MockUserSet struct {
|
||||
Users []config.User
|
||||
Users []vmess.User
|
||||
UserHashes map[string]int
|
||||
Timestamps map[string]int64
|
||||
}
|
||||
|
||||
func (us *MockUserSet) AddUser(user config.User) error {
|
||||
func (us *MockUserSet) AddUser(user vmess.User) error {
|
||||
us.Users = append(us.Users, user)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (us *MockUserSet) GetUser(userhash []byte) (config.User, int64, bool) {
|
||||
func (us *MockUserSet) GetUser(userhash []byte) (vmess.User, int64, bool) {
|
||||
idx, found := us.UserHashes[string(userhash)]
|
||||
if found {
|
||||
return us.Users[idx], us.Timestamps[string(userhash)], true
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
package mocks
|
||||
|
||||
import (
|
||||
"github.com/v2ray/v2ray-core/proxy/vmess/config"
|
||||
"github.com/v2ray/v2ray-core/proxy/vmess"
|
||||
)
|
||||
|
||||
type StaticUser struct {
|
||||
id *config.ID
|
||||
id *vmess.ID
|
||||
}
|
||||
|
||||
func (this *StaticUser) ID() *config.ID {
|
||||
func (this *StaticUser) ID() *vmess.ID {
|
||||
return this.id
|
||||
}
|
||||
|
||||
func (this *StaticUser) Level() config.UserLevel {
|
||||
return config.UserLevelUntrusted
|
||||
func (this *StaticUser) Level() vmess.UserLevel {
|
||||
return vmess.UserLevelUntrusted
|
||||
}
|
||||
|
||||
type StaticUserSet struct {
|
||||
}
|
||||
|
||||
func (us *StaticUserSet) AddUser(user config.User) error {
|
||||
func (us *StaticUserSet) AddUser(user vmess.User) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (us *StaticUserSet) GetUser(userhash []byte) (config.User, int64, bool) {
|
||||
id, _ := config.NewID("703e9102-eb57-499c-8b59-faf4f371bb21")
|
||||
func (us *StaticUserSet) GetUser(userhash []byte) (vmess.User, int64, bool) {
|
||||
id, _ := vmess.NewID("703e9102-eb57-499c-8b59-faf4f371bb21")
|
||||
return &StaticUser{id: id}, 0, true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user