mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-10 19:38:28 +01:00
recognize keys=shareddest
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / buster (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / buster (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
This commit is contained in:
parent
fe3e7b1f6e
commit
b500374f74
2 changed files with 44 additions and 23 deletions
|
@ -265,11 +265,15 @@ namespace client
|
|||
}
|
||||
}
|
||||
|
||||
bool ClientContext::LoadPrivateKeys (i2p::data::PrivateKeys& keys, const std::string& filename,
|
||||
bool ClientContext::LoadPrivateKeys (i2p::data::PrivateKeys& keys, std::string_view filename,
|
||||
i2p::data::SigningKeyType sigType, i2p::data::CryptoKeyType cryptoType)
|
||||
{
|
||||
static const std::string transient("transient");
|
||||
#if __cplusplus >= 202002L // C++20
|
||||
if (filename.starts_with ("transient"))
|
||||
#else
|
||||
std::string_view transient("transient");
|
||||
if (!filename.compare (0, transient.length (), transient)) // starts with transient
|
||||
#endif
|
||||
{
|
||||
keys = i2p::data::PrivateKeys::CreateRandomKeys (sigType, cryptoType, true);
|
||||
LogPrint (eLogInfo, "Clients: New transient keys address ", m_AddressBook.ToAddress(keys.GetPublic ()->GetIdentHash ()), " created");
|
||||
|
@ -599,7 +603,9 @@ namespace client
|
|||
options[I2CP_PARAM_OUTBOUND_NICKNAME] = name;
|
||||
|
||||
std::shared_ptr<ClientDestination> localDestination = nullptr;
|
||||
if (keys.length () > 0)
|
||||
if (keys == "shareddest")
|
||||
localDestination = m_SharedLocalDestination;
|
||||
else if (keys.length () > 0)
|
||||
{
|
||||
auto it = destinations.find (keys);
|
||||
if (it != destinations.end ())
|
||||
|
@ -758,26 +764,31 @@ namespace client
|
|||
options[I2CP_PARAM_INBOUND_NICKNAME] = name;
|
||||
|
||||
std::shared_ptr<ClientDestination> localDestination = nullptr;
|
||||
auto it = destinations.find (keys);
|
||||
if (it != destinations.end ())
|
||||
{
|
||||
localDestination = it->second;
|
||||
localDestination->SetPublic (true);
|
||||
}
|
||||
if (keys == "shareddest")
|
||||
localDestination = m_SharedLocalDestination;
|
||||
else
|
||||
{
|
||||
i2p::data::PrivateKeys k;
|
||||
if(!LoadPrivateKeys (k, keys, sigType, cryptoType))
|
||||
continue;
|
||||
localDestination = FindLocalDestination (k.GetPublic ()->GetIdentHash ());
|
||||
if (!localDestination)
|
||||
{
|
||||
auto it = destinations.find (keys);
|
||||
if (it != destinations.end ())
|
||||
{
|
||||
localDestination = CreateNewLocalDestination (k, true, &options);
|
||||
destinations[keys] = localDestination;
|
||||
localDestination = it->second;
|
||||
localDestination->SetPublic (true);
|
||||
}
|
||||
else
|
||||
localDestination->SetPublic (true);
|
||||
}
|
||||
{
|
||||
i2p::data::PrivateKeys k;
|
||||
if(!LoadPrivateKeys (k, keys, sigType, cryptoType))
|
||||
continue;
|
||||
localDestination = FindLocalDestination (k.GetPublic ()->GetIdentHash ());
|
||||
if (!localDestination)
|
||||
{
|
||||
localDestination = CreateNewLocalDestination (k, true, &options);
|
||||
destinations[keys] = localDestination;
|
||||
}
|
||||
else
|
||||
localDestination->SetPublic (true);
|
||||
}
|
||||
}
|
||||
if (type == I2P_TUNNELS_SECTION_TYPE_UDPSERVER)
|
||||
{
|
||||
// udp server tunnel
|
||||
|
@ -897,7 +908,12 @@ namespace client
|
|||
i2p::config::GetOption("addressbook.enabled", httpAddresshelper); // addresshelper is not supported without address book
|
||||
i2p::data::SigningKeyType sigType; i2p::config::GetOption("httpproxy.signaturetype", sigType);
|
||||
LogPrint(eLogInfo, "Clients: Starting HTTP Proxy at ", httpProxyAddr, ":", httpProxyPort);
|
||||
if (httpProxyKeys.length () > 0)
|
||||
if (httpProxyKeys == "shareddest")
|
||||
{
|
||||
localDestination = m_SharedLocalDestination;
|
||||
localDestination->Acquire ();
|
||||
}
|
||||
else if (httpProxyKeys.length () > 0)
|
||||
{
|
||||
i2p::data::PrivateKeys keys;
|
||||
if(LoadPrivateKeys (keys, httpProxyKeys, sigType))
|
||||
|
@ -941,7 +957,12 @@ namespace client
|
|||
uint16_t socksOutProxyPort; i2p::config::GetOption("socksproxy.outproxyport", socksOutProxyPort);
|
||||
i2p::data::SigningKeyType sigType; i2p::config::GetOption("socksproxy.signaturetype", sigType);
|
||||
LogPrint(eLogInfo, "Clients: Starting SOCKS Proxy at ", socksProxyAddr, ":", socksProxyPort);
|
||||
if (httpProxyKeys == socksProxyKeys && m_HttpProxy)
|
||||
if (socksProxyKeys == "shareddest")
|
||||
{
|
||||
localDestination = m_SharedLocalDestination;
|
||||
localDestination->Acquire ();
|
||||
}
|
||||
else if (httpProxyKeys == socksProxyKeys && m_HttpProxy)
|
||||
{
|
||||
localDestination = m_HttpProxy->GetLocalDestination ();
|
||||
localDestination->Acquire ();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013-2024, The PurpleI2P Project
|
||||
* Copyright (c) 2013-2025, The PurpleI2P Project
|
||||
*
|
||||
* This file is part of Purple i2pd project and licensed under BSD3
|
||||
*
|
||||
|
@ -92,7 +92,7 @@ namespace client
|
|||
const std::string & name, const std::map<std::string, std::string> * params = nullptr);
|
||||
void DeleteLocalDestination (std::shared_ptr<ClientDestination> destination);
|
||||
std::shared_ptr<ClientDestination> FindLocalDestination (const i2p::data::IdentHash& destination) const;
|
||||
bool LoadPrivateKeys (i2p::data::PrivateKeys& keys, const std::string& filename,
|
||||
bool LoadPrivateKeys (i2p::data::PrivateKeys& keys, std::string_view filename,
|
||||
i2p::data::SigningKeyType sigType = i2p::data::SIGNING_KEY_TYPE_EDDSA_SHA512_ED25519,
|
||||
i2p::data::CryptoKeyType cryptoType = i2p::data::CRYPTO_KEY_TYPE_ELGAMAL);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue