Skip to content

Commit

Permalink
fixup! Upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielius1922 committed May 1, 2024
1 parent 6ddc368 commit d1c4088
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions net/connUDP_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,28 +284,30 @@ func TestControlMessageString(t *testing.T) {
func getIfaceAddr(t *testing.T, iface net.Interface, ipv4 bool) net.IP {
addrs, err := iface.Addrs()
require.NoError(t, err)
require.NotEmpty(t, addrs)
var ipOut net.IP
for _, addr := range addrs {
ip, _, err := net.ParseCIDR(addr.String())
require.NoError(t, err)
if !ip.IsPrivate() {
continue
}
if ipv4 {
if ip.To4() != nil {
return ip
}
if ipv4 && ip.To4() == nil {
continue
}
return ip
ipOut = ip
break
}
return nil
require.NotEmpty(t, ipOut)
return ipOut
}

func TestUDPConnWriteToAddr(t *testing.T) {
ifaces, err := net.Interfaces()
require.NoError(t, err)
var iface net.Interface
for _, i := range ifaces {
t.Logf("interface name:%v, flags: %v", i.Name, i.Flags)
if i.Flags&net.FlagUp == net.FlagUp && i.Flags&net.FlagMulticast == net.FlagMulticast && i.Flags&net.FlagLoopback != net.FlagLoopback {
iface = i
break
Expand Down

0 comments on commit d1c4088

Please sign in to comment.