mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 15:37:26 -06:00
Add a "Use proxy for hostname lookup" option
Add a UI option for "Use proxy for hostname lookup" option and plumb it into libtorrent's settings_pack.proxy_hostnames option. This is available for SOCKS5 and HTTP proxies, and defaults to true, which is the previous functionality. Hostname lookups can be forced to be local by unchecking this option, which can aid compatibility with certain non-compliant proxy servers. Closes #17902. PR #17904. Co-authored-by: Nathan Lewis <saturn@saturn49.dyndns.org>
This commit is contained in:
@@ -260,6 +260,8 @@ 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;
|
||||
|
||||
@@ -475,6 +475,7 @@ 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
|
||||
@@ -1644,6 +1645,7 @@ void SessionImpl::loadLTSettings(lt::settings_pack &settingsPack)
|
||||
}
|
||||
|
||||
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::announce_to_all_trackers, announceToAllTrackers());
|
||||
@@ -3442,6 +3444,20 @@ 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;
|
||||
|
||||
@@ -240,6 +240,8 @@ 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;
|
||||
@@ -645,6 +647,7 @@ 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;
|
||||
|
||||
Reference in New Issue
Block a user