mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-08-26 10:10:24 +01:00
handle session with STYLE=DATAGRAM2 and STYLE=DATAGRAM3
Some checks failed
Build containers / Building container for linux/386 (push) Has been cancelled
Build Debian packages / bookworm (push) Has been cancelled
Build Debian packages / bullseye (push) Has been cancelled
Build Debian packages / trixie (push) Has been cancelled
Build on FreeBSD / with UPnP (push) Has been cancelled
Build on OSX / With USE_UPNP=no (push) Has been cancelled
Build on OSX / With USE_UPNP=yes (push) Has been cancelled
Build on Windows / clang-x86_64 (push) Has been cancelled
Build on Windows / i686 (push) Has been cancelled
Build on Windows / ucrt-x86_64 (push) Has been cancelled
Build on Windows / x86_64 (push) Has been cancelled
Build on Windows / CMake clang-x86_64 (push) Has been cancelled
Build on Windows / CMake i686 (push) Has been cancelled
Build on Windows / CMake ucrt-x86_64 (push) Has been cancelled
Build on Windows / CMake x86_64 (push) Has been cancelled
Build on Windows / XP (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=no (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=yes (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Has been cancelled
Build containers / Building container for linux/amd64 (push) Has been cancelled
Build containers / Building container for linux/arm64 (push) Has been cancelled
Build containers / Building container for linux/arm/v7 (push) Has been cancelled
Build containers / Pushing merged manifest (push) Has been cancelled
Some checks failed
Build containers / Building container for linux/386 (push) Has been cancelled
Build Debian packages / bookworm (push) Has been cancelled
Build Debian packages / bullseye (push) Has been cancelled
Build Debian packages / trixie (push) Has been cancelled
Build on FreeBSD / with UPnP (push) Has been cancelled
Build on OSX / With USE_UPNP=no (push) Has been cancelled
Build on OSX / With USE_UPNP=yes (push) Has been cancelled
Build on Windows / clang-x86_64 (push) Has been cancelled
Build on Windows / i686 (push) Has been cancelled
Build on Windows / ucrt-x86_64 (push) Has been cancelled
Build on Windows / x86_64 (push) Has been cancelled
Build on Windows / CMake clang-x86_64 (push) Has been cancelled
Build on Windows / CMake i686 (push) Has been cancelled
Build on Windows / CMake ucrt-x86_64 (push) Has been cancelled
Build on Windows / CMake x86_64 (push) Has been cancelled
Build on Windows / XP (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=no (push) Has been cancelled
Build on Ubuntu / Make with USE_UPNP=yes (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Has been cancelled
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Has been cancelled
Build containers / Building container for linux/amd64 (push) Has been cancelled
Build containers / Building container for linux/arm64 (push) Has been cancelled
Build containers / Building container for linux/arm/v7 (push) Has been cancelled
Build containers / Pushing merged manifest (push) Has been cancelled
This commit is contained in:
parent
6b9278fdd3
commit
d5769080c8
2 changed files with 27 additions and 7 deletions
|
@ -353,8 +353,27 @@ namespace client
|
|||
}
|
||||
|
||||
SAMSessionType type = eSAMSessionTypeUnknown;
|
||||
i2p::datagram::DatagramVersion datagramVersion = i2p::datagram::eDatagramV1;
|
||||
if (style == SAM_VALUE_STREAM) type = eSAMSessionTypeStream;
|
||||
else if (style == SAM_VALUE_DATAGRAM) type = eSAMSessionTypeDatagram;
|
||||
#if __cplusplus >= 202002L // C++20
|
||||
else if (style.starts_with (SAM_VALUE_DATAGRAM))
|
||||
#else
|
||||
else if (style.substr (0, SAM_VALUE_DATAGRAM.size ()) == SAM_VALUE_DATAGRAM)
|
||||
#endif
|
||||
{
|
||||
// DATAGRAM, DATAGRAM1, DATAGRAM2, DATAGRAM3
|
||||
type = eSAMSessionTypeDatagram;
|
||||
if (style.size () > SAM_VALUE_DATAGRAM.size ())
|
||||
{
|
||||
switch (style[SAM_VALUE_DATAGRAM.size ()])
|
||||
{
|
||||
case '1': datagramVersion = i2p::datagram::eDatagramV1; break;
|
||||
case '2': datagramVersion = i2p::datagram::eDatagramV2; break;
|
||||
case '3': datagramVersion = i2p::datagram::eDatagramV3; break;
|
||||
default: type = eSAMSessionTypeUnknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (style == SAM_VALUE_RAW) type = eSAMSessionTypeRaw;
|
||||
else if (style == SAM_VALUE_MASTER) type = eSAMSessionTypeMaster;
|
||||
if (type == eSAMSessionTypeUnknown)
|
||||
|
@ -416,7 +435,7 @@ namespace client
|
|||
if (type == eSAMSessionTypeDatagram || type == eSAMSessionTypeRaw)
|
||||
{
|
||||
session->UDPEndpoint = forward;
|
||||
auto dest = session->GetLocalDestination ()->CreateDatagramDestination ();
|
||||
auto dest = session->GetLocalDestination ()->CreateDatagramDestination (false, datagramVersion);
|
||||
uint16_t port = 0;
|
||||
if (forward)
|
||||
{
|
||||
|
|
|
@ -83,13 +83,14 @@ namespace client
|
|||
const char SAM_PARAM_PORT[] = "PORT";
|
||||
const char SAM_PARAM_FROM_PORT[] = "FROM_PORT";
|
||||
const char SAM_VALUE_TRANSIENT[] = "TRANSIENT";
|
||||
const char SAM_VALUE_STREAM[] = "STREAM";
|
||||
const char SAM_VALUE_DATAGRAM[] = "DATAGRAM";
|
||||
const char SAM_VALUE_RAW[] = "RAW";
|
||||
const char SAM_VALUE_MASTER[] = "MASTER";
|
||||
const char SAM_VALUE_TRUE[] = "true";
|
||||
const char SAM_VALUE_FALSE[] = "false";
|
||||
|
||||
|
||||
constexpr std::string_view SAM_VALUE_STREAM { "STREAM" };
|
||||
constexpr std::string_view SAM_VALUE_DATAGRAM { "DATAGRAM" };
|
||||
constexpr std::string_view SAM_VALUE_RAW { "RAW" };
|
||||
constexpr std::string_view SAM_VALUE_MASTER { "MASTER" };
|
||||
|
||||
enum SAMSocketType
|
||||
{
|
||||
eSAMSocketTypeUnknown,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue