diff --git a/build-all.sh b/build-all.sh index 47908a3..cfe68db 100755 --- a/build-all.sh +++ b/build-all.sh @@ -44,7 +44,7 @@ GOBIN="go" $GOBIN version -LDFLAGS="'-s -w'" +LDFLAGS="'-s -w -checklinkname=0'" FAILURES="" ROOT=${PWD} OUTPUT="${ROOT}/dist/TorrServer" diff --git a/server/dlna/dlna.go b/server/dlna/dlna.go index 9915b21..e322da9 100644 --- a/server/dlna/dlna.go +++ b/server/dlna/dlna.go @@ -13,6 +13,7 @@ import ( "github.com/anacrolix/dms/dlna/dms" "github.com/anacrolix/log" + "github.com/wlynxg/anet" "server/settings" "server/web/pages/template" @@ -26,7 +27,7 @@ func Start() { Logger: logger.WithNames("dms", "server"), Interfaces: func() (ifs []net.Interface) { var err error - ifaces, err := net.Interfaces() + ifaces, err := anet.Interfaces() if err != nil { logger.Levelf(log.Error, "%v", err) return @@ -171,7 +172,7 @@ func getDefaultFriendlyName() string { } if host == "localhost" { // useless host, use 1st IP - ifaces, err := net.Interfaces() + ifaces, err := anet.Interfaces() if err != nil { return ret + ": " + userName + "@" + host } diff --git a/server/go.mod b/server/go.mod index fd6df13..214cb60 100644 --- a/server/go.mod +++ b/server/go.mod @@ -23,6 +23,7 @@ require ( github.com/swaggo/files v1.0.1 github.com/swaggo/gin-swagger v1.6.0 github.com/swaggo/swag v1.16.3 + github.com/wlynxg/anet v0.0.5 go.etcd.io/bbolt v1.3.10 golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc golang.org/x/image v0.18.0 diff --git a/server/go.sum b/server/go.sum index 682c1ef..8d2b457 100644 --- a/server/go.sum +++ b/server/go.sum @@ -338,6 +338,8 @@ github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65E github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= +github.com/wlynxg/anet v0.0.5 h1:J3VJGi1gvo0JwZ/P1/Yc/8p63SoW98B5dHkYDmpgvvU= +github.com/wlynxg/anet v0.0.5/go.mod h1:eay5PRQr7fIVAMbTbchTnO9gG65Hg/uYGdc7mguHxoA= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= diff --git a/server/torr/btserver.go b/server/torr/btserver.go index 30e0a64..13d4396 100644 --- a/server/torr/btserver.go +++ b/server/torr/btserver.go @@ -10,6 +10,7 @@ import ( "github.com/anacrolix/publicip" "github.com/anacrolix/torrent" "github.com/anacrolix/torrent/metainfo" + "github.com/wlynxg/anet" "server/settings" "server/torr/storage/torrstor" @@ -207,7 +208,7 @@ func isPrivateIP(ip net.IP) bool { } func getPublicIp4() net.IP { - ifaces, err := net.Interfaces() + ifaces, err := anet.Interfaces() if err != nil { log.Println("Error get public IPv4") return nil @@ -233,7 +234,7 @@ func getPublicIp4() net.IP { } func getPublicIp6() net.IP { - ifaces, err := net.Interfaces() + ifaces, err := anet.Interfaces() if err != nil { log.Println("Error get public IPv6") return nil diff --git a/server/web/server.go b/server/web/server.go index 79c5f1d..5e73c1b 100644 --- a/server/web/server.go +++ b/server/web/server.go @@ -10,6 +10,7 @@ import ( "github.com/gin-contrib/cors" "github.com/gin-contrib/location" "github.com/gin-gonic/gin" + "github.com/wlynxg/anet" "server/dlna" "server/settings" @@ -139,7 +140,7 @@ func echo(c *gin.Context) { } func getLocalIps() []string { - ifaces, err := net.Interfaces() + ifaces, err := anet.Interfaces() if err != nil { log.TLogln("Error get local IPs") return nil