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

From 2431ea44a76881ed5a8d0877b5b95ea0b2f24370 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 987a355..dccb46c 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.46.0
 	github.com/vishvananda/netlink v1.3.0
-	github.com/wlynxg/anet v0.0.5
 	golang.org/x/crypto v0.29.0
 	golang.org/x/net v0.31.0
 	golang.org/x/sys v0.27.0
diff --git a/go.sum b/go.sum
index 8531a2a..f88998a 100644
--- a/go.sum
+++ b/go.sum
@@ -71,8 +71,6 @@ github.com/vishvananda/netlink v1.3.0 h1:X7l42GfcV4S6E4vHTsw48qbrV+9PVojNfIhZcwQ
 github.com/vishvananda/netlink v1.3.0/go.mod h1:i6NetklAujEcC6fK0JPjT8qSwWyO0HLn4UKG+hGqeJs=
 github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8=
 github.com/vishvananda/netns v0.0.4/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=
 golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
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.0