dae/common/netutils/ip46_test.go
mzz a6382423a4
fix: bad ipversion selection caused by #251 (#257)
* fix: bad ipversion selection caused by #251

* chore: upgrade softwind
2023-08-05 18:18:21 +08:00

23 lines
491 B
Go

package netutils
import (
"context"
"net/netip"
"testing"
"time"
"github.com/daeuniverse/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")
}
}