mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
Auto detect public IPs if not provided by user
adopted code from anacrolix/confluence 3c7a0c445d
This commit is contained in:
@@ -30,7 +30,7 @@ func Start(port string) {
|
||||
log.TLogln("Start TorrServer")
|
||||
ips := getLocalIps()
|
||||
if len(ips) > 0 {
|
||||
log.TLogln("IPs:", ips)
|
||||
log.TLogln("Local IPs:", ips)
|
||||
}
|
||||
err := BTS.Connect()
|
||||
if err != nil {
|
||||
@@ -102,7 +102,7 @@ func getLocalIps() []string {
|
||||
case *net.IPAddr:
|
||||
ip = v.IP
|
||||
}
|
||||
if !ip.IsLoopback() {
|
||||
if !ip.IsLoopback() && !ip.IsLinkLocalUnicast() && !ip.IsLinkLocalMulticast() {
|
||||
list = append(list, ip.String())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user