From 439c91d5099c0a70bc4938c10a08293afa29d06e Mon Sep 17 00:00:00 2001 From: RPRX <63339210+rprx@users.noreply.github.com> Date: Wed, 10 Mar 2021 14:55:51 +0000 Subject: [PATCH] Update fakedns_test.go --- app/dns/fakedns/fakedns_test.go | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/app/dns/fakedns/fakedns_test.go b/app/dns/fakedns/fakedns_test.go index a9ddc4cf..b0812f62 100644 --- a/app/dns/fakedns/fakedns_test.go +++ b/app/dns/fakedns/fakedns_test.go @@ -4,6 +4,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + "github.com/xtls/xray-core/common" "github.com/xtls/xray-core/common/net" "github.com/xtls/xray-core/common/uuid" @@ -18,7 +19,7 @@ func TestFakeDnsHolderCreateMapping(t *testing.T) { fkdns, err := NewFakeDNSHolder() common.Must(err) - addr := fkdns.GetFakeIPForDomain("fakednstest.v2fly.org") + addr := fkdns.GetFakeIPForDomain("fakednstest.example.com") assert.Equal(t, "240.", addr[0].IP().String()[0:4]) } @@ -26,10 +27,10 @@ func TestFakeDnsHolderCreateMappingMany(t *testing.T) { fkdns, err := NewFakeDNSHolder() common.Must(err) - addr := fkdns.GetFakeIPForDomain("fakednstest.v2fly.org") + addr := fkdns.GetFakeIPForDomain("fakednstest.example.com") assert.Equal(t, "240.", addr[0].IP().String()[0:4]) - addr2 := fkdns.GetFakeIPForDomain("fakednstest2.v2fly.org") + addr2 := fkdns.GetFakeIPForDomain("fakednstest2.example.com") assert.Equal(t, "240.", addr2[0].IP().String()[0:4]) assert.NotEqual(t, addr[0].IP().String(), addr2[0].IP().String()) } @@ -38,17 +39,17 @@ func TestFakeDnsHolderCreateMappingManyAndResolve(t *testing.T) { fkdns, err := NewFakeDNSHolder() common.Must(err) - addr := fkdns.GetFakeIPForDomain("fakednstest.v2fly.org") - addr2 := fkdns.GetFakeIPForDomain("fakednstest2.v2fly.org") + addr := fkdns.GetFakeIPForDomain("fakednstest.example.com") + addr2 := fkdns.GetFakeIPForDomain("fakednstest2.example.com") { result := fkdns.GetDomainFromFakeDNS(addr[0]) - assert.Equal(t, "fakednstest.v2fly.org", result) + assert.Equal(t, "fakednstest.example.com", result) } { result := fkdns.GetDomainFromFakeDNS(addr2[0]) - assert.Equal(t, "fakednstest2.v2fly.org", result) + assert.Equal(t, "fakednstest2.example.com", result) } } @@ -56,8 +57,8 @@ func TestFakeDnsHolderCreateMappingManySingleDomain(t *testing.T) { fkdns, err := NewFakeDNSHolder() common.Must(err) - addr := fkdns.GetFakeIPForDomain("fakednstest.v2fly.org") - addr2 := fkdns.GetFakeIPForDomain("fakednstest.v2fly.org") + addr := fkdns.GetFakeIPForDomain("fakednstest.example.com") + addr2 := fkdns.GetFakeIPForDomain("fakednstest.example.com") assert.Equal(t, addr[0].IP().String(), addr2[0].IP().String()) } @@ -72,23 +73,23 @@ func TestFakeDnsHolderCreateMappingAndRollOver(t *testing.T) { common.Must(err) - addr := fkdns.GetFakeIPForDomain("fakednstest.v2fly.org") - addr2 := fkdns.GetFakeIPForDomain("fakednstest2.v2fly.org") + addr := fkdns.GetFakeIPForDomain("fakednstest.example.com") + addr2 := fkdns.GetFakeIPForDomain("fakednstest2.example.com") for i := 0; i <= 8192; i++ { { result := fkdns.GetDomainFromFakeDNS(addr[0]) - assert.Equal(t, "fakednstest.v2fly.org", result) + assert.Equal(t, "fakednstest.example.com", result) } { result := fkdns.GetDomainFromFakeDNS(addr2[0]) - assert.Equal(t, "fakednstest2.v2fly.org", result) + assert.Equal(t, "fakednstest2.example.com", result) } { uuid := uuid.New() - domain := uuid.String() + ".fakednstest.v2fly.org" + domain := uuid.String() + ".fakednstest.example.com" tempAddr := fkdns.GetFakeIPForDomain(domain) rsaddr := tempAddr[0].IP().String()