mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-14 02:53:02 +00:00
9112cfd39c
* Remove legacy Vmess * validators * protos
35 lines
624 B
Go
35 lines
624 B
Go
package vmess_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/xtls/xray-core/common"
|
|
"github.com/xtls/xray-core/common/protocol"
|
|
"github.com/xtls/xray-core/common/uuid"
|
|
. "github.com/xtls/xray-core/proxy/vmess"
|
|
)
|
|
|
|
func toAccount(a *Account) protocol.Account {
|
|
account, err := a.AsAccount()
|
|
common.Must(err)
|
|
return account
|
|
}
|
|
|
|
func BenchmarkUserValidator(b *testing.B) {
|
|
for i := 0; i < b.N; i++ {
|
|
v := NewTimedUserValidator()
|
|
|
|
for j := 0; j < 1500; j++ {
|
|
id := uuid.New()
|
|
v.Add(&protocol.MemoryUser{
|
|
Email: "test",
|
|
Account: toAccount(&Account{
|
|
Id: id.String(),
|
|
}),
|
|
})
|
|
}
|
|
|
|
common.Close(v)
|
|
}
|
|
}
|