|
|
@@ -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")
|
|
|
+ }
|
|
|
}
|
|
|
}
|