qt: newer options added; not tested

This commit is contained in:
user 2020-10-21 14:46:31 +08:00
parent 005581ef62
commit 17f5bcbd1c
8 changed files with 249 additions and 42 deletions

View file

@ -545,6 +545,18 @@ private:
void deleteTunnelForms();
void deleteTunnelFromUI(std::string tunnelName, TunnelConfig* cnf);
template<typename Section>
std::string GetI2CPOption (const Section& section, const std::string& name, const std::string& value) const
{
return section.second.get (boost::property_tree::ptree::path_type (name, '/'), value);
}
template<typename Section>
std::string GetI2CPOption (const Section& section, const std::string& name, const char* value) const
{
return section.second.get (boost::property_tree::ptree::path_type (name, '/'), std::string (value));
}
template<typename Section, typename Type>
std::string GetI2CPOption (const Section& section, const std::string& name, const Type& value) const
{
@ -565,6 +577,19 @@ private:
param.setOutbound_quantity(QString(_OUTBOUND_TUNNELS_QUANTITY.c_str()));
std::string _TAGS_TO_SEND = options[I2CP_PARAM_TAGS_TO_SEND] = GetI2CPOption (section, I2CP_PARAM_TAGS_TO_SEND, DEFAULT_TAGS_TO_SEND);
param.setCrypto_tagsToSend(QString(_TAGS_TO_SEND.c_str()));
std::string _i2cp_leaseSetAuthType = options[I2CP_PARAM_LEASESET_AUTH_TYPE] = GetI2CPOption (section, I2CP_PARAM_LEASESET_AUTH_TYPE, 0);
param.set_i2cp_leaseSetAuthType(QString(_i2cp_leaseSetAuthType.c_str()));
const char DEFAULT_LEASESET_ENCRYPTION_TYPE[] = "";
std::string _i2cp_leaseSetEncType = options[I2CP_PARAM_LEASESET_ENCRYPTION_TYPE] = GetI2CPOption (section, I2CP_PARAM_LEASESET_ENCRYPTION_TYPE, DEFAULT_LEASESET_ENCRYPTION_TYPE);//todo Identity's type by default
param.set_i2cp_leaseSetEncType(QString(_i2cp_leaseSetEncType.c_str()));
std::string _i2cp_leaseSetPrivKey = options[I2CP_PARAM_LEASESET_PRIV_KEY] = GetI2CPOption (section, I2CP_PARAM_LEASESET_PRIV_KEY, "");
param.set_i2cp_leaseSetPrivKey(QString(_i2cp_leaseSetPrivKey.c_str()));
std::string _i2cp_leaseSetType = options[I2CP_PARAM_LEASESET_TYPE] = GetI2CPOption (section, I2CP_PARAM_LEASESET_TYPE, DEFAULT_LEASESET_TYPE);
param.set_i2cp_leaseSetType(QString(_i2cp_leaseSetType.c_str()));
std::string _i2p_streaming_answerPings= options[I2CP_PARAM_STREAMING_ANSWER_PINGS] = GetI2CPOption (section, I2CP_PARAM_STREAMING_ANSWER_PINGS, DEFAULT_ANSWER_PINGS);
param.set_i2p_streaming_answerPings((_i2p_streaming_answerPings.compare("true")==0)||(_i2p_streaming_answerPings.compare("yes")==0));
std::string _i2p_streaming_initialAckDelay = options[I2CP_PARAM_STREAMING_INITIAL_ACK_DELAY] = GetI2CPOption (section, I2CP_PARAM_STREAMING_INITIAL_ACK_DELAY, DEFAULT_INITIAL_ACK_DELAY);
param.set_i2p_streaming_initialAckDelay(QString(_i2p_streaming_initialAckDelay.c_str()));
options[I2CP_PARAM_MIN_TUNNEL_LATENCY] = GetI2CPOption(section, I2CP_PARAM_MIN_TUNNEL_LATENCY, DEFAULT_MIN_TUNNEL_LATENCY);//TODO include into param
options[I2CP_PARAM_MAX_TUNNEL_LATENCY] = GetI2CPOption(section, I2CP_PARAM_MAX_TUNNEL_LATENCY, DEFAULT_MAX_TUNNEL_LATENCY);//TODO include into param
}
@ -582,6 +607,17 @@ private:
param.setOutbound_quantity(QString::number(_OUTBOUND_TUNNELS_QUANTITY));
const int _TAGS_TO_SEND = DEFAULT_TAGS_TO_SEND;
param.setCrypto_tagsToSend(QString::number(_TAGS_TO_SEND));
const int _i2cp_leaseSetAuthType = 0;
param.set_i2cp_leaseSetAuthType(QString::number(_i2cp_leaseSetAuthType));
const QString _i2cp_leaseSetEncType = "0,4"; //todo Identity's type by default
param.set_i2cp_leaseSetEncType(_i2cp_leaseSetEncType);
param.set_i2cp_leaseSetPrivKey("");
const int _i2cp_leaseSetType = DEFAULT_LEASESET_TYPE;
param.set_i2cp_leaseSetType(QString::number(_i2cp_leaseSetType));
bool _i2p_streaming_answerPings= DEFAULT_ANSWER_PINGS;
param.set_i2p_streaming_answerPings(_i2p_streaming_answerPings);
const int _i2p_streaming_initialAckDelay = DEFAULT_INITIAL_ACK_DELAY;
param.set_i2p_streaming_initialAckDelay(QString::number(_i2p_streaming_initialAckDelay));
}