Xray-core/proxy/vmess/validator_test.go

35 lines
624 B
Go
Raw Permalink Normal View History

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++ {
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{
Id: id.String(),
2020-11-25 14:01:53 +03:00
}),
})
}
common.Close(v)
}
}