mirror of
https://github.com/daeuniverse/dae.git
synced 2025-01-13 08:14:33 +07:00
23 lines
487 B
Go
23 lines
487 B
Go
|
package netutils
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"net/netip"
|
||
|
"testing"
|
||
|
"time"
|
||
|
|
||
|
"github.com/mzz2017/softwind/protocol/direct"
|
||
|
)
|
||
|
|
||
|
func TestResolveIp46(t *testing.T) {
|
||
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||
|
defer cancel()
|
||
|
ip46, err := ResolveIp46(ctx, direct.SymmetricDirect, netip.MustParseAddrPort("223.5.5.5:53"), "www.apple.com", "udp", false)
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
if !ip46.Ip4.IsValid() && !ip46.Ip6.IsValid() {
|
||
|
t.Fatal("No record")
|
||
|
}
|
||
|
}
|