mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
more test cases
This commit is contained in:
parent
619f4eae59
commit
1226f3ce39
@ -3,6 +3,8 @@ package impl_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"v2ray.com/core/app/proxyman"
|
||||
|
||||
. "v2ray.com/core/app/dispatcher/impl"
|
||||
. "v2ray.com/ext/assert"
|
||||
)
|
||||
@ -184,3 +186,9 @@ func TestTLSHeaders(t *testing.T) {
|
||||
assert(err, Equals, test.err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnknownSniffer(t *testing.T) {
|
||||
assert := With(t)
|
||||
|
||||
assert(func() { NewSniffer([]proxyman.KnownProtocols{proxyman.KnownProtocols(-1)}) }, Panics)
|
||||
}
|
||||
|
@ -85,3 +85,19 @@ func TestParseIPv6Address(t *testing.T) {
|
||||
assert(ip, IsIPv4)
|
||||
assert(ip.String(), Equals, "123.151.71.143")
|
||||
}
|
||||
|
||||
func TestInvalidAddressConvertion(t *testing.T) {
|
||||
assert := With(t)
|
||||
|
||||
assert(func() { ParseAddress("8.8.8.8").Domain() }, Panics)
|
||||
assert(func() { ParseAddress("2001:4860:0:2001::68").Domain() }, Panics)
|
||||
assert(func() { ParseAddress("v2ray.com").IP() }, Panics)
|
||||
}
|
||||
|
||||
func TestIPOrDomain(t *testing.T) {
|
||||
assert := With(t)
|
||||
|
||||
assert(NewIPOrDomain(ParseAddress("v2ray.com")).AsAddress(), Equals, ParseAddress("v2ray.com"))
|
||||
assert(NewIPOrDomain(ParseAddress("8.8.8.8")).AsAddress(), Equals, ParseAddress("8.8.8.8"))
|
||||
assert(NewIPOrDomain(ParseAddress("2001:4860:0:2001::68")).AsAddress(), Equals, ParseAddress("2001:4860:0:2001::68"))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user