mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
Display External IP Address in status bar
This change displays the last detected IPv4 and/or IPv6 address(es) in the GUI and WebUI's status bar. This does not yet handle systems with multiple addresses of the same type (e.g. multiple IPv6 addresses). PR #21383. --------- Co-authored-by: Odin Vex <44311901+OdinVex@users.noreply.github.com>
This commit is contained in:
parent
fb9b3c0f34
commit
f89c4c32ed
15 changed files with 155 additions and 13 deletions
|
@ -4967,6 +4967,16 @@ void SessionImpl::setTrackerFilteringEnabled(const bool enabled)
|
|||
}
|
||||
}
|
||||
|
||||
QString SessionImpl::lastExternalIPv4Address() const
|
||||
{
|
||||
return m_lastExternalIPv4Address;
|
||||
}
|
||||
|
||||
QString SessionImpl::lastExternalIPv6Address() const
|
||||
{
|
||||
return m_lastExternalIPv6Address;
|
||||
}
|
||||
|
||||
bool SessionImpl::isListening() const
|
||||
{
|
||||
return m_nativeSessionExtension->isSessionListening();
|
||||
|
@ -5988,11 +5998,19 @@ void SessionImpl::handleExternalIPAlert(const lt::external_ip_alert *alert)
|
|||
LogMsg(tr("Detected external IP. IP: \"%1\"")
|
||||
.arg(externalIP), Log::INFO);
|
||||
|
||||
if (m_lastExternalIP != externalIP)
|
||||
const bool isIPv6 = alert->external_address.is_v6();
|
||||
const bool isIPv4 = alert->external_address.is_v4();
|
||||
if (isIPv6 && (externalIP != m_lastExternalIPv6Address))
|
||||
{
|
||||
if (isReannounceWhenAddressChangedEnabled() && !m_lastExternalIP.isEmpty())
|
||||
if (isReannounceWhenAddressChangedEnabled() && !m_lastExternalIPv6Address.isEmpty())
|
||||
reannounceToAllTrackers();
|
||||
m_lastExternalIP = externalIP;
|
||||
m_lastExternalIPv6Address = externalIP;
|
||||
}
|
||||
else if (isIPv4 && (externalIP != m_lastExternalIPv4Address))
|
||||
{
|
||||
if (isReannounceWhenAddressChangedEnabled() && !m_lastExternalIPv4Address.isEmpty())
|
||||
reannounceToAllTrackers();
|
||||
m_lastExternalIPv4Address = externalIP;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue