mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-26 17:03:02 +00:00
adjust
This commit is contained in:
parent
a229a7f85e
commit
500c6de359
@ -21,17 +21,17 @@ func TestStaticHosts(t *testing.T) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Type: DomainMatchingType_Full,
|
Type: DomainMatchingType_Full,
|
||||||
Domain: "proxy.v2fly.org",
|
Domain: "proxy.xray.com",
|
||||||
Ip: [][]byte{
|
Ip: [][]byte{
|
||||||
{1, 2, 3, 4},
|
{1, 2, 3, 4},
|
||||||
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
|
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},
|
||||||
},
|
},
|
||||||
ProxiedDomain: "another-proxy.v2fly.org",
|
ProxiedDomain: "another-proxy.xray.com",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Type: DomainMatchingType_Full,
|
Type: DomainMatchingType_Full,
|
||||||
Domain: "proxy2.v2fly.org",
|
Domain: "proxy2.xray.com",
|
||||||
ProxiedDomain: "proxy.v2fly.org",
|
ProxiedDomain: "proxy.xray.com",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Type: DomainMatchingType_Subdomain,
|
Type: DomainMatchingType_Subdomain,
|
||||||
@ -67,27 +67,27 @@ func TestStaticHosts(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
domain := hosts.Lookup("proxy.v2fly.org", dns.IPOption{
|
domain := hosts.Lookup("proxy.xray.com", dns.IPOption{
|
||||||
IPv4Enable: true,
|
IPv4Enable: true,
|
||||||
IPv6Enable: false,
|
IPv6Enable: false,
|
||||||
})
|
})
|
||||||
if len(domain) != 1 {
|
if len(domain) != 1 {
|
||||||
t.Error("expect 1 domain, but got ", len(domain))
|
t.Error("expect 1 domain, but got ", len(domain))
|
||||||
}
|
}
|
||||||
if diff := cmp.Diff(domain[0].Domain(), "another-proxy.v2fly.org"); diff != "" {
|
if diff := cmp.Diff(domain[0].Domain(), "another-proxy.xray.com"); diff != "" {
|
||||||
t.Error(diff)
|
t.Error(diff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
domain := hosts.Lookup("proxy2.v2fly.org", dns.IPOption{
|
domain := hosts.Lookup("proxy2.xray.com", dns.IPOption{
|
||||||
IPv4Enable: true,
|
IPv4Enable: true,
|
||||||
IPv6Enable: false,
|
IPv6Enable: false,
|
||||||
})
|
})
|
||||||
if len(domain) != 1 {
|
if len(domain) != 1 {
|
||||||
t.Error("expect 1 domain, but got ", len(domain))
|
t.Error("expect 1 domain, but got ", len(domain))
|
||||||
}
|
}
|
||||||
if diff := cmp.Diff(domain[0].Domain(), "another-proxy.v2fly.org"); diff != "" {
|
if diff := cmp.Diff(domain[0].Domain(), "another-proxy.xray.com"); diff != "" {
|
||||||
t.Error(diff)
|
t.Error(diff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,13 @@ import (
|
|||||||
func BenchmarkACAutomaton(b *testing.B) {
|
func BenchmarkACAutomaton(b *testing.B) {
|
||||||
ac := NewACAutomaton()
|
ac := NewACAutomaton()
|
||||||
for i := 1; i <= 1024; i++ {
|
for i := 1; i <= 1024; i++ {
|
||||||
ac.Add(strconv.Itoa(i)+".v2ray.com", Domain)
|
ac.Add(strconv.Itoa(i)+".xray.com", Domain)
|
||||||
}
|
}
|
||||||
ac.Build()
|
ac.Build()
|
||||||
|
|
||||||
b.ResetTimer()
|
b.ResetTimer()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
_ = ac.Match("0.v2ray.com")
|
_ = ac.Match("0.xray.com")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user