Add support for allow_idna option

Upstream PR: https://github.com/arvidn/libtorrent/pull/5316
This commit is contained in:
Chocobo1
2020-12-01 10:53:48 +08:00
committed by sledgehammer999
parent e5d7738127
commit 0b42425db5
6 changed files with 55 additions and 1 deletions

View File

@@ -309,6 +309,8 @@ void AppController::preferencesAction()
data["upnp_lease_duration"] = session->UPnPLeaseDuration();
// uTP-TCP mixed mode
data["utp_tcp_mixed_mode"] = static_cast<int>(session->utpMixedMode());
// Support internationalized domain name (IDN)
data["idn_support_enabled"] = session->isIDNSupportEnabled();
// Multiple connections per IP
data["enable_multi_connections_from_same_ip"] = session->multiConnectionsPerIpEnabled();
// Validate HTTPS tracker certificate
@@ -771,6 +773,9 @@ void AppController::setPreferencesAction()
// uTP-TCP mixed mode
if (hasKey("utp_tcp_mixed_mode"))
session->setUtpMixedMode(static_cast<BitTorrent::MixedModeAlgorithm>(it.value().toInt()));
// Support internationalized domain name (IDN)
if (hasKey("idn_support_enabled"))
session->setIDNSupportEnabled(it.value().toBool());
// Multiple connections per IP
if (hasKey("enable_multi_connections_from_same_ip"))
session->setMultiConnectionsPerIpEnabled(it.value().toBool());

View File

@@ -1099,6 +1099,14 @@
</select>
</td>
</tr>
<tr>
<td>
<label for="IDNSupportCheckbox">QBT_TR(Support internationalized domain name (IDN) (requires libtorrent >= 1.2.12):)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#allow_idna" target="_blank">(?)</a></label>
</td>
<td>
<input type="checkbox" id="IDNSupportCheckbox" />
</td>
</tr>
<tr>
<td>
<label for="allowMultipleConnectionsFromTheSameIPAddress">QBT_TR(Allow multiple connections from the same IP address:)QBT_TR[CONTEXT=OptionsDialog]&nbsp;<a href="https://www.libtorrent.org/reference-Settings.html#allow_multiple_connections_per_ip" target="_blank">(?)</a></label>
@@ -1895,6 +1903,7 @@
$('outgoingPortsMax').setProperty('value', pref.outgoing_ports_max);
$('UPnPLeaseDuration').setProperty('value', pref.upnp_lease_duration);
$('utpTCPMixedModeAlgorithm').setProperty('value', pref.utp_tcp_mixed_mode);
$('IDNSupportCheckbox').setProperty('checked', pref.idn_support_enabled);
$('allowMultipleConnectionsFromTheSameIPAddress').setProperty('checked', pref.enable_multi_connections_from_same_ip);
$('validateHTTPSTrackerCertificate').setProperty('checked', pref.validate_https_tracker_certificate);
$('blockPeersOnPrivilegedPorts').setProperty('checked', pref.block_peers_on_privileged_ports);
@@ -2282,6 +2291,7 @@
settings.set('outgoing_ports_max', $('outgoingPortsMax').getProperty('value'));
settings.set('upnp_lease_duration', $('UPnPLeaseDuration').getProperty('value'));
settings.set('utp_tcp_mixed_mode', $('utpTCPMixedModeAlgorithm').getProperty('value'));
settings.set('idn_support_enabled', $('IDNSupportCheckbox').getProperty('checked'));
settings.set('enable_multi_connections_from_same_ip', $('allowMultipleConnectionsFromTheSameIPAddress').getProperty('checked'));
settings.set('validate_https_tracker_certificate', $('validateHTTPSTrackerCertificate').getProperty('checked'));
settings.set('block_peers_on_privileged_ports', $('blockPeersOnPrivilegedPorts').getProperty('checked'));