Xray-core/proxy/vmess/validator_test.go

35 lines
624 B
Go
Raw Normal View History

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