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