38 , proxyAddrData(proxyAddrData)
50 from.options =
nullptr;
51 from.proxyAddrData.clear();
59 ToxOptions::operator Tox_Options*()
72 Tox_Options* tox_opts = tox_options_new(
nullptr);
75 qWarning() <<
"Failed to create Tox_Options";
82 auto toxOptions = std::unique_ptr<ToxOptions>(
new ToxOptions(tox_opts, proxyAddr.toUtf8()));
87 tox_options_set_savedata_type(*toxOptions, savedata.isNull() ? TOX_SAVEDATA_TYPE_NONE
88 : TOX_SAVEDATA_TYPE_TOX_SAVE);
89 tox_options_set_savedata_data(*toxOptions,
reinterpret_cast<const uint8_t*
>(savedata.data()),
101 if (!enableLanDiscovery) {
102 qWarning() <<
"Core starting without LAN discovery. Peers can only be found through DHT.";
105 qDebug() <<
"Core starting with IPv6 enabled";
106 }
else if (enableLanDiscovery) {
107 qWarning() <<
"Core starting with IPv6 disabled. LAN discovery may not work properly.";
111 tox_options_set_proxy_type(*toxOptions, TOX_PROXY_TYPE_NONE);
112 tox_options_set_proxy_host(*toxOptions,
nullptr);
113 tox_options_set_proxy_port(*toxOptions, 0);
116 if (
static_cast<uint32_t
>(proxyAddr.length()) > tox_max_hostname_length()) {
117 qWarning() <<
"Proxy address" << proxyAddr <<
"is too long";
118 }
else if (!proxyAddr.isEmpty() && proxyPort > 0) {
119 qDebug() <<
"Using proxy" << proxyAddr <<
":" << proxyPort;
122 tox_options_set_proxy_type(*toxOptions, TOX_PROXY_TYPE_SOCKS5);
124 tox_options_set_proxy_type(*toxOptions, TOX_PROXY_TYPE_HTTP);
127 tox_options_set_proxy_host(*toxOptions, toxOptions->getProxyAddrData());
128 tox_options_set_proxy_port(*toxOptions, proxyPort);
131 qDebug() <<
"Proxy and UDP enabled. This is a security risk. Forcing TCP only.";
138 tox_options_set_udp_enabled(*toxOptions, !forceTCP);
139 tox_options_set_ipv6_enabled(*toxOptions, enableIPv6);
140 tox_options_set_local_discovery_enabled(*toxOptions, enableLanDiscovery);
141 tox_options_set_start_port(*toxOptions, 0);
142 tox_options_set_end_port(*toxOptions, 0);
149 return tox_options_get_ipv6_enabled(
options);
154 tox_options_set_ipv6_enabled(
options, enabled);