2020-11-25 11:01:53 +00:00
|
|
|
package vmess_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-12-04 01:36:16 +00:00
|
|
|
"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"
|
2020-11-25 11:01:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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++ {
|
2023-06-12 14:32:25 +00:00
|
|
|
v := NewTimedUserValidator()
|
2020-11-25 11:01:53 +00:00
|
|
|
|
|
|
|
for j := 0; j < 1500; j++ {
|
|
|
|
id := uuid.New()
|
|
|
|
v.Add(&protocol.MemoryUser{
|
|
|
|
Email: "test",
|
|
|
|
Account: toAccount(&Account{
|
2021-12-15 00:28:47 +00:00
|
|
|
Id: id.String(),
|
2020-11-25 11:01:53 +00:00
|
|
|
}),
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
common.Close(v)
|
|
|
|
}
|
|
|
|
}
|