1
0
mirror of https://github.com/fumiama/terasu.git synced 2026-06-05 01:00:23 +08:00

feat: add DoH fallback supports

This commit is contained in:
源文雨
2024-05-02 18:19:19 +09:00
parent 871703d644
commit c887e26289
5 changed files with 279 additions and 13 deletions

View File

@@ -24,6 +24,29 @@ func TestResolver(t *testing.T) {
}
}
func TestResolverFallback(t *testing.T) {
t.Log("IsIPv6Available:", ip.IsIPv6Available.Get())
if ip.IsIPv6Available.Get() {
addrs, err := IPv6Servers.LookupHostFallback(context.TODO(), "huggingface.co")
if err != nil {
t.Fatal(err)
}
t.Log(addrs)
if len(addrs) == 0 {
t.Fail()
}
}
addrs, err := IPv4Servers.LookupHostFallback(context.TODO(), "huggingface.co")
if err != nil {
t.Fatal(err)
}
t.Log(addrs)
if len(addrs) == 0 {
t.Fail()
}
}
func TestDNS(t *testing.T) {
if ip.IsIPv6Available.Get() {
IPv6Servers.test()