mirror of https://github.com/XTLS/Xray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
624 B
35 lines
624 B
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)
|
|
}
|
|
}
|