Skip to content

Commit

Permalink
set default i2cp.leaseSetEncType to 0,4 and to 4 for server tunnels
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Sep 12, 2024
1 parent cb0801f commit ebec4d8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
14 changes: 5 additions & 9 deletions libi2pd/Destination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1013,18 +1013,15 @@ namespace client
}
}
// if no param or valid crypto type use from identity
bool isSingleKey = false;
if (encryptionKeyTypes.empty ())
{
isSingleKey = true;
encryptionKeyTypes.insert (GetIdentity ()->GetCryptoKeyType ());
}
encryptionKeyTypes.insert ( { GetIdentity ()->GetCryptoKeyType (),
i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD }); // usually 0,4

for (auto& it: encryptionKeyTypes)
{
auto encryptionKey = new EncryptionKey (it);
if (IsPublic ())
PersistTemporaryKeys (encryptionKey, isSingleKey);
PersistTemporaryKeys (encryptionKey);
else
encryptionKey->GenerateKeys ();
encryptionKey->CreateDecryptor ();
Expand Down Expand Up @@ -1383,12 +1380,11 @@ namespace client
return ret;
}

void ClientDestination::PersistTemporaryKeys (EncryptionKey * keys, bool isSingleKey)
void ClientDestination::PersistTemporaryKeys (EncryptionKey * keys)
{
if (!keys) return;
std::string ident = GetIdentHash().ToBase32();
std::string path = i2p::fs::DataDirPath("destinations",
isSingleKey ? (ident + ".dat") : (ident + "." + std::to_string (keys->keyType) + ".dat"));
std::string path = i2p::fs::DataDirPath("destinations", ident + "." + std::to_string (keys->keyType) + ".dat");
std::ifstream f(path, std::ifstream::binary);

if (f) {
Expand Down
2 changes: 1 addition & 1 deletion libi2pd/Destination.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ namespace client
std::shared_ptr<ClientDestination> GetSharedFromThis () {
return std::static_pointer_cast<ClientDestination>(shared_from_this ());
}
void PersistTemporaryKeys (EncryptionKey * keys, bool isSingleKey);
void PersistTemporaryKeys (EncryptionKey * keys);
void ReadAuthKey (const std::string& group, const std::map<std::string, std::string> * params);

template<typename Dest>
Expand Down

0 comments on commit ebec4d8

Please sign in to comment.