|
|
@@ -21,6 +21,20 @@ func TestStaticHosts(t *testing.T) {
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
+ Type: DomainMatchingType_Full,
|
|
|
+ Domain: "proxy.v2fly.org",
|
|
|
+ Ip: [][]byte{
|
|
|
+ {1, 2, 3, 4},
|
|
|
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
|
|
|
+ },
|
|
|
+ ProxiedDomain: "another-proxy.v2fly.org",
|
|
|
+ },
|
|
|
+ {
|
|
|
+ Type: DomainMatchingType_Full,
|
|
|
+ Domain: "proxy2.v2fly.org",
|
|
|
+ ProxiedDomain: "proxy.v2fly.org",
|
|
|
+ },
|
|
|
+ {
|
|
|
Type: DomainMatchingType_Subdomain,
|
|
|
Domain: "v2ray.cn",
|
|
|
Ip: [][]byte{
|
|
|
@@ -54,6 +68,32 @@ func TestStaticHosts(t *testing.T) {
|
|
|
}
|
|
|
|
|
|
{
|
|
|
+ domain := hosts.Lookup("proxy.v2fly.org", dns.IPOption{
|
|
|
+ IPv4Enable: true,
|
|
|
+ IPv6Enable: false,
|
|
|
+ })
|
|
|
+ if len(domain) != 1 {
|
|
|
+ t.Error("expect 1 domain, but got ", len(domain))
|
|
|
+ }
|
|
|
+ if diff := cmp.Diff(domain[0].Domain(), "another-proxy.v2fly.org"); diff != "" {
|
|
|
+ t.Error(diff)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ domain := hosts.Lookup("proxy2.v2fly.org", dns.IPOption{
|
|
|
+ IPv4Enable: true,
|
|
|
+ IPv6Enable: false,
|
|
|
+ })
|
|
|
+ if len(domain) != 1 {
|
|
|
+ t.Error("expect 1 domain, but got ", len(domain))
|
|
|
+ }
|
|
|
+ if diff := cmp.Diff(domain[0].Domain(), "another-proxy.v2fly.org"); diff != "" {
|
|
|
+ t.Error(diff)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
ips := hosts.Lookup("www.v2ray.cn", dns.IPOption{
|
|
|
IPv4Enable: true,
|
|
|
IPv6Enable: true,
|