改进DNS域名解析相关函数

This commit is contained in:
刘祥超
2023-06-05 12:36:29 +08:00
parent 8b804cb500
commit 7fbc61aa21
6 changed files with 199 additions and 30 deletions

View File

@@ -4,6 +4,7 @@ package utils_test
import (
"github.com/TeaOSLab/EdgeAPI/internal/utils"
"github.com/TeaOSLab/EdgeCommon/pkg/dnsconfigs"
"testing"
)
@@ -12,9 +13,25 @@ func TestLookupCNAME(t *testing.T) {
}
func TestLookupNS(t *testing.T) {
t.Log(utils.LookupNS("goedge.cn"))
t.Log(utils.LookupNS("goedge.cn", nil))
}
func TestLookupNSExtra(t *testing.T) {
t.Log(utils.LookupNS("goedge.cn", []*dnsconfigs.DNSResolver{
{
Host: "192.168.2.2",
},
{
Host: "192.168.2.2",
Port: 58,
},
{
Host: "8.8.8.8",
Port: 53,
},
}))
}
func TestLookupTXT(t *testing.T) {
t.Log(utils.LookupTXT("yanzheng.goedge.cn"))
t.Log(utils.LookupTXT("yanzheng.goedge.cn", nil))
}