File yggdrasil-no-anet-dep.patch of Package yggdrasil-go

From d55d2d3a99cc477344b835bdc20f59b2faeb7e1b Mon Sep 17 00:00:00 2001
From: Oleg Girko <ol@infoserver.lv>
Date: Sun, 3 Nov 2024 01:42:51 +0000
Subject: [PATCH] Revert "Restore local peer discovery mechanism on Android 11+
 (#1158)"

This is not needed for Linux, but it introduces unnecessary dependency
that needs tweaking linker args in Go 1.23 and later.

Hence, it's easier to revert a small change introducing this dependency
than to package this dependency and tweak linker flags just for it.

This reverts commit 947b6ad7aa93eb2174bf16ddac844c7afaf2677d.
---
 go.mod                     |  1 -
 go.sum                     |  2 --
 src/multicast/multicast.go | 10 +++-------
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/go.mod b/go.mod
index 222cb1e..cc8e583 100644
--- a/go.mod
+++ b/go.mod
@@ -13,7 +13,6 @@ require (
 	github.com/kardianos/minwinsvc v1.0.2
 	github.com/quic-go/quic-go v0.48.2
 	github.com/vishvananda/netlink v1.3.0
-	github.com/wlynxg/anet v0.0.5
 	golang.org/x/crypto v0.31.0
 	golang.org/x/net v0.32.0
 	golang.org/x/sys v0.28.0
diff --git a/go.sum b/go.sum
index c7a4d38..f4973fd 100644
--- a/go.sum
+++ b/go.sum
@@ -83,8 +83,6 @@ github.com/vishvananda/netlink v1.3.0/go.mod h1:i6NetklAujEcC6fK0JPjT8qSwWyO0HLn
 github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
 github.com/vishvananda/netns v0.0.5 h1:DfiHV+j8bA32MFM7bfEunvT8IAqQ/NzSJHtcmW5zdEY=
 github.com/vishvananda/netns v0.0.5/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
-github.com/wlynxg/anet v0.0.5 h1:J3VJGi1gvo0JwZ/P1/Yc/8p63SoW98B5dHkYDmpgvvU=
-github.com/wlynxg/anet v0.0.5/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA=
 go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
 go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
 go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
diff --git a/src/multicast/multicast.go b/src/multicast/multicast.go
index 9134501..18371de 100644
--- a/src/multicast/multicast.go
+++ b/src/multicast/multicast.go
@@ -14,7 +14,6 @@ import (
 
 	"github.com/Arceliar/phony"
 	"github.com/gologme/log"
-	"github.com/wlynxg/anet"
 
 	"github.com/yggdrasil-network/yggdrasil-go/src/core"
 	"golang.org/x/crypto/blake2b"
@@ -149,8 +148,7 @@ func (m *Multicast) _stop() error {
 func (m *Multicast) _updateInterfaces() {
 	interfaces := m._getAllowedInterfaces()
 	for name, info := range interfaces {
-		// 'anet' package is used here to avoid https://github.com/golang/go/issues/40569
-		addrs, err := anet.InterfaceAddrsByInterface(&info.iface)
+		addrs, err := info.iface.Addrs()
 		if err != nil {
 			m.log.Warnf("Failed up get addresses for interface %s: %s", name, err)
 			delete(interfaces, name)
@@ -164,7 +162,6 @@ func (m *Multicast) _updateInterfaces() {
 			info.addrs = append(info.addrs, addr)
 		}
 		interfaces[name] = info
-		m.log.Debugf("Discovered addresses for interface %s: %s", name, addrs)
 	}
 	m._interfaces = interfaces
 }
@@ -183,11 +180,10 @@ func (m *Multicast) Interfaces() map[string]net.Interface {
 func (m *Multicast) _getAllowedInterfaces() map[string]*interfaceInfo {
 	interfaces := make(map[string]*interfaceInfo)
 	// Ask the system for network interfaces
-	// 'anet' package is used here to avoid https://github.com/golang/go/issues/40569
-	allifaces, err := anet.Interfaces()
+	allifaces, err := net.Interfaces()
 	if err != nil {
 		// Don't panic, since this may be from e.g. too many open files (from too much connection spam)
-		m.log.Debugf("Failed to get interfaces: %s", err)
+		// TODO? log something
 		return nil
 	}
 	// Work out which interfaces to announce on
-- 
2.47.1