|
|
@ -327,7 +327,7 @@ namespace llarp
|
|
|
|
Encrypted<64> tmp;
|
|
|
|
Encrypted<64> tmp;
|
|
|
|
tmp.Randomize();
|
|
|
|
tmp.Randomize();
|
|
|
|
llarp_buffer_t buf(tmp.data(), tmp.size());
|
|
|
|
llarp_buffer_t buf(tmp.data(), tmp.size());
|
|
|
|
AsyncEncryptAndSendTo(buf, eProtocolControl);
|
|
|
|
AsyncEncryptAndSendTo(buf, ProtocolType::Control);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -551,7 +551,7 @@ namespace llarp
|
|
|
|
ProtocolMessage msg{};
|
|
|
|
ProtocolMessage msg{};
|
|
|
|
if (frame.DecryptPayloadInto(sessionKey, msg))
|
|
|
|
if (frame.DecryptPayloadInto(sessionKey, msg))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (msg.proto == eProtocolAuth and not msg.payload.empty())
|
|
|
|
if (msg.proto == ProtocolType::Auth and not msg.payload.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
result.reason = std::string{
|
|
|
|
result.reason = std::string{
|
|
|
|
reinterpret_cast<const char*>(msg.payload.data()), msg.payload.size()};
|
|
|
|
reinterpret_cast<const char*>(msg.payload.data()), msg.payload.size()};
|
|
|
@ -574,7 +574,7 @@ namespace llarp
|
|
|
|
authResultListener = nullptr;
|
|
|
|
authResultListener = nullptr;
|
|
|
|
hook = [handler](std::shared_ptr<ProtocolMessage> msg) {
|
|
|
|
hook = [handler](std::shared_ptr<ProtocolMessage> msg) {
|
|
|
|
AuthResult result{AuthResultCode::eAuthAccepted, "OK"};
|
|
|
|
AuthResult result{AuthResultCode::eAuthAccepted, "OK"};
|
|
|
|
if (msg->proto == eProtocolAuth and not msg->payload.empty())
|
|
|
|
if (msg->proto == ProtocolType::Auth and not msg->payload.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
result.reason = std::string{
|
|
|
|
result.reason = std::string{
|
|
|
|
reinterpret_cast<const char*>(msg->payload.data()), msg->payload.size()};
|
|
|
|
reinterpret_cast<const char*>(msg->payload.data()), msg->payload.size()};
|
|
|
@ -605,7 +605,7 @@ namespace llarp
|
|
|
|
void
|
|
|
|
void
|
|
|
|
OutboundContext::SendPacketToRemote(const llarp_buffer_t& buf)
|
|
|
|
OutboundContext::SendPacketToRemote(const llarp_buffer_t& buf)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
AsyncEncryptAndSendTo(buf, eProtocolExit);
|
|
|
|
AsyncEncryptAndSendTo(buf, ProtocolType::Exit);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace service
|
|
|
|
} // namespace service
|
|
|
|