mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
update benchmark for address
This commit is contained in:
parent
91227581e5
commit
d675bb92df
@ -104,18 +104,27 @@ func TestIPOrDomain(t *testing.T) {
|
||||
|
||||
func BenchmarkParseAddressIPv4(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = ParseAddress("8.8.8.8")
|
||||
addr := ParseAddress("8.8.8.8")
|
||||
if addr.Family() != AddressFamilyIPv4 {
|
||||
panic("not ipv4")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkParseAddressIPv6(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = ParseAddress("2001:4860:0:2001::68")
|
||||
addr := ParseAddress("2001:4860:0:2001::68")
|
||||
if addr.Family() != AddressFamilyIPv6 {
|
||||
panic("not ipv6")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkParseAddressDomain(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
_ = ParseAddress("v2ray.com")
|
||||
addr := ParseAddress("v2ray.com")
|
||||
if addr.Family() != AddressFamilyDomain {
|
||||
panic("not domain")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user