mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 16:37:21 -06:00
Add option to bind directly to an IP instead of using a network Interface
This commit is contained in:
committed by
sledgehammer999
parent
3c6b79805c
commit
dc011a5599
@@ -659,7 +659,7 @@ void Session::setSessionSettings()
|
||||
// Include overhead in transfer limits
|
||||
sessionSettings.rate_limit_ip_overhead = pref->includeOverheadInLimits();
|
||||
// IP address to announce to trackers
|
||||
sessionSettings.announce_ip = Utils::String::toStdString(pref->getNetworkAddress());
|
||||
sessionSettings.announce_ip = Utils::String::toStdString(pref->getAnnounceAddress());
|
||||
// Super seeding
|
||||
sessionSettings.strict_super_seeding = pref->isSuperSeedingEnabled();
|
||||
// * Max Half-open connections
|
||||
@@ -1734,6 +1734,13 @@ const QStringList Session::getListeningIPs()
|
||||
Logger* const logger = Logger::instance();
|
||||
QStringList IPs;
|
||||
|
||||
//Take the override addresss
|
||||
const QString networkAddr = pref->getNetworkAddress();
|
||||
if ( !networkAddr.isEmpty()) {
|
||||
IPs.append( networkAddr);
|
||||
return IPs;
|
||||
}
|
||||
|
||||
const QString ifaceName = pref->getNetworkInterface();
|
||||
const bool listenIPv6 = pref->getListenIPv6();
|
||||
|
||||
|
||||
@@ -1339,6 +1339,16 @@ QString Preferences::getNetworkInterfaceName() const
|
||||
return value("Preferences/Connection/InterfaceName").toString();
|
||||
}
|
||||
|
||||
void Preferences::setNetworkAddress(const QString& iface)
|
||||
{
|
||||
setValue("Preferences/Connection/InterfaceAddress", iface);
|
||||
}
|
||||
|
||||
QString Preferences::getNetworkAddress() const
|
||||
{
|
||||
return value("Preferences/Connection/InterfaceAddress").toString();
|
||||
}
|
||||
|
||||
void Preferences::setNetworkInterfaceName(const QString& iface)
|
||||
{
|
||||
setValue("Preferences/Connection/InterfaceName", iface);
|
||||
@@ -1354,14 +1364,14 @@ void Preferences::setListenIPv6(bool enable)
|
||||
setValue("Preferences/Connection/InterfaceListenIPv6", enable);
|
||||
}
|
||||
|
||||
QString Preferences::getNetworkAddress() const
|
||||
QString Preferences::getAnnounceAddress() const
|
||||
{
|
||||
return value("Preferences/Connection/InetAddress").toString();
|
||||
return value("Preferences/Connection/AnnounceAddress").toString();
|
||||
}
|
||||
|
||||
void Preferences::setNetworkAddress(const QString& addr)
|
||||
void Preferences::setAnnounceAddress(const QString& addr)
|
||||
{
|
||||
setValue("Preferences/Connection/InetAddress", addr);
|
||||
setValue("Preferences/Connection/AnnounceAddress", addr);
|
||||
}
|
||||
|
||||
bool Preferences::isAnonymousModeEnabled() const
|
||||
|
||||
@@ -361,12 +361,14 @@ public:
|
||||
void setMaxHalfOpenConnections(int value);
|
||||
QString getNetworkInterface() const;
|
||||
void setNetworkInterface(const QString& iface);
|
||||
QString getNetworkAddress() const;
|
||||
void setNetworkAddress(const QString& iface);
|
||||
QString getNetworkInterfaceName() const;
|
||||
void setNetworkInterfaceName(const QString& iface);
|
||||
bool getListenIPv6() const;
|
||||
void setListenIPv6(bool enable);
|
||||
QString getNetworkAddress() const;
|
||||
void setNetworkAddress(const QString& addr);
|
||||
QString getAnnounceAddress() const;
|
||||
void setAnnounceAddress(const QString& addr);
|
||||
bool isAnonymousModeEnabled() const;
|
||||
void enableAnonymousMode(bool enabled);
|
||||
bool isSuperSeedingEnabled() const;
|
||||
|
||||
Reference in New Issue
Block a user