mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 23:17:21 -06:00
Expand the scope of "Proxy hostname lookup" option
This commit is contained in:
@@ -262,8 +262,6 @@ namespace BitTorrent
|
||||
virtual void setMaxActiveCheckingTorrents(int val) = 0;
|
||||
virtual bool isProxyPeerConnectionsEnabled() const = 0;
|
||||
virtual void setProxyPeerConnectionsEnabled(bool enabled) = 0;
|
||||
virtual bool isProxyHostnameLookupEnabled() const = 0;
|
||||
virtual void setProxyHostnameLookupEnabled(bool enabled) = 0;
|
||||
virtual ChokingAlgorithm chokingAlgorithm() const = 0;
|
||||
virtual void setChokingAlgorithm(ChokingAlgorithm mode) = 0;
|
||||
virtual SeedChokingAlgorithm seedChokingAlgorithm() const = 0;
|
||||
|
||||
@@ -495,7 +495,6 @@ SessionImpl::SessionImpl(QObject *parent)
|
||||
, m_encryption(BITTORRENT_SESSION_KEY(u"Encryption"_qs), 0)
|
||||
, m_maxActiveCheckingTorrents(BITTORRENT_SESSION_KEY(u"MaxActiveCheckingTorrents"_qs), 1)
|
||||
, m_isProxyPeerConnectionsEnabled(BITTORRENT_SESSION_KEY(u"ProxyPeerConnections"_qs), false)
|
||||
, m_isProxyHostnameLookupEnabled(BITTORRENT_SESSION_KEY(u"ProxyHostnameLookup"_qs), true)
|
||||
, m_chokingAlgorithm(BITTORRENT_SESSION_KEY(u"ChokingAlgorithm"_qs), ChokingAlgorithm::FixedSlots
|
||||
, clampValue(ChokingAlgorithm::FixedSlots, ChokingAlgorithm::RateBased))
|
||||
, m_seedChokingAlgorithm(BITTORRENT_SESSION_KEY(u"SeedChokingAlgorithm"_qs), SeedChokingAlgorithm::FastestUpload
|
||||
@@ -1669,7 +1668,7 @@ lt::settings_pack SessionImpl::loadLTSettings() const
|
||||
}
|
||||
|
||||
settingsPack.set_bool(lt::settings_pack::proxy_peer_connections, isProxyPeerConnectionsEnabled());
|
||||
settingsPack.set_bool(lt::settings_pack::proxy_hostnames, isProxyHostnameLookupEnabled());
|
||||
settingsPack.set_bool(lt::settings_pack::proxy_hostnames, proxyConfig.hostnameLookupEnabled);
|
||||
}
|
||||
|
||||
settingsPack.set_bool(lt::settings_pack::announce_to_all_trackers, announceToAllTrackers());
|
||||
@@ -3545,20 +3544,6 @@ void SessionImpl::setProxyPeerConnectionsEnabled(const bool enabled)
|
||||
}
|
||||
}
|
||||
|
||||
bool SessionImpl::isProxyHostnameLookupEnabled() const
|
||||
{
|
||||
return m_isProxyHostnameLookupEnabled;
|
||||
}
|
||||
|
||||
void SessionImpl::setProxyHostnameLookupEnabled(const bool enabled)
|
||||
{
|
||||
if (enabled != isProxyHostnameLookupEnabled())
|
||||
{
|
||||
m_isProxyHostnameLookupEnabled = enabled;
|
||||
configureDeferred();
|
||||
}
|
||||
}
|
||||
|
||||
ChokingAlgorithm SessionImpl::chokingAlgorithm() const
|
||||
{
|
||||
return m_chokingAlgorithm;
|
||||
|
||||
@@ -239,8 +239,6 @@ namespace BitTorrent
|
||||
void setMaxActiveCheckingTorrents(int val) override;
|
||||
bool isProxyPeerConnectionsEnabled() const override;
|
||||
void setProxyPeerConnectionsEnabled(bool enabled) override;
|
||||
bool isProxyHostnameLookupEnabled() const override;
|
||||
void setProxyHostnameLookupEnabled(bool enabled) override;
|
||||
ChokingAlgorithm chokingAlgorithm() const override;
|
||||
void setChokingAlgorithm(ChokingAlgorithm mode) override;
|
||||
SeedChokingAlgorithm seedChokingAlgorithm() const override;
|
||||
@@ -655,7 +653,6 @@ namespace BitTorrent
|
||||
CachedSettingValue<int> m_encryption;
|
||||
CachedSettingValue<int> m_maxActiveCheckingTorrents;
|
||||
CachedSettingValue<bool> m_isProxyPeerConnectionsEnabled;
|
||||
CachedSettingValue<bool> m_isProxyHostnameLookupEnabled;
|
||||
CachedSettingValue<ChokingAlgorithm> m_chokingAlgorithm;
|
||||
CachedSettingValue<SeedChokingAlgorithm> m_seedChokingAlgorithm;
|
||||
CachedSettingValue<QStringList> m_storedTags;
|
||||
|
||||
@@ -250,6 +250,11 @@ void Net::DownloadManager::applyProxySettings()
|
||||
m_proxy.setUser(proxyConfig.username);
|
||||
m_proxy.setPassword(proxyConfig.password);
|
||||
}
|
||||
|
||||
if (proxyConfig.hostnameLookupEnabled)
|
||||
m_proxy.setCapabilities(m_proxy.capabilities() | QNetworkProxy::HostNameLookupCapability);
|
||||
else
|
||||
m_proxy.setCapabilities(m_proxy.capabilities() & ~QNetworkProxy::HostNameLookupCapability);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ bool Net::operator==(const ProxyConfiguration &left, const ProxyConfiguration &r
|
||||
&& (left.port == right.port)
|
||||
&& (left.authEnabled == right.authEnabled)
|
||||
&& (left.username == right.username)
|
||||
&& (left.password == right.password);
|
||||
&& (left.password == right.password)
|
||||
&& (left.hostnameLookupEnabled == right.hostnameLookupEnabled);
|
||||
}
|
||||
|
||||
bool Net::operator!=(const ProxyConfiguration &left, const ProxyConfiguration &right)
|
||||
@@ -57,6 +58,7 @@ ProxyConfigurationManager::ProxyConfigurationManager(QObject *parent)
|
||||
, m_storeProxyAuthEnabled {SETTINGS_KEY(u"AuthEnabled"_qs)}
|
||||
, m_storeProxyUsername {SETTINGS_KEY(u"Username"_qs)}
|
||||
, m_storeProxyPassword {SETTINGS_KEY(u"Password"_qs)}
|
||||
, m_storeProxyHostnameLookupEnabled {SETTINGS_KEY(u"HostnameLookupEnabled"_qs)}
|
||||
{
|
||||
m_config.type = m_storeProxyType.get(ProxyType::HTTP);
|
||||
if ((m_config.type < ProxyType::HTTP) || (m_config.type > ProxyType::SOCKS4))
|
||||
@@ -66,6 +68,7 @@ ProxyConfigurationManager::ProxyConfigurationManager(QObject *parent)
|
||||
m_config.authEnabled = m_storeProxyAuthEnabled;
|
||||
m_config.username = m_storeProxyUsername;
|
||||
m_config.password = m_storeProxyPassword;
|
||||
m_config.hostnameLookupEnabled = m_storeProxyHostnameLookupEnabled.get(true);
|
||||
}
|
||||
|
||||
void ProxyConfigurationManager::initInstance()
|
||||
@@ -101,6 +104,7 @@ void ProxyConfigurationManager::setProxyConfiguration(const ProxyConfiguration &
|
||||
m_storeProxyAuthEnabled = config.authEnabled;
|
||||
m_storeProxyUsername = config.username;
|
||||
m_storeProxyPassword = config.password;
|
||||
m_storeProxyHostnameLookupEnabled = config.hostnameLookupEnabled;
|
||||
|
||||
emit proxyConfigurationChanged();
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace Net
|
||||
bool authEnabled = false;
|
||||
QString username;
|
||||
QString password;
|
||||
bool hostnameLookupEnabled = true;
|
||||
};
|
||||
bool operator==(const ProxyConfiguration &left, const ProxyConfiguration &right);
|
||||
bool operator!=(const ProxyConfiguration &left, const ProxyConfiguration &right);
|
||||
@@ -85,5 +86,6 @@ namespace Net
|
||||
SettingValue<bool> m_storeProxyAuthEnabled;
|
||||
SettingValue<QString> m_storeProxyUsername;
|
||||
SettingValue<QString> m_storeProxyPassword;
|
||||
SettingValue<bool> m_storeProxyHostnameLookupEnabled;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user