Xray-core/proxy/vmess/validator_test.go
yuhan6665 9112cfd39c
Clean legacy vmess (#2199)
* Remove legacy Vmess

* validators

* protos
2023-06-12 10:32:25 -04:00

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)
}
}