use github.com/wlynxg/anet package

may fix #253
This commit is contained in:
nikk gitanes
2025-01-25 08:59:47 +03:00
parent f2ffd092ff
commit 95bbf831f5
6 changed files with 12 additions and 6 deletions

View File

@@ -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