From a4e6d8120bf566fcc57f03e987a167d4a8a57a2c Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 24 May 2017 12:49:36 -0400 Subject: [PATCH] handle iexp --- libi2pd/RouterInfo.cpp | 14 ++++++++++++++ libi2pd/RouterInfo.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/libi2pd/RouterInfo.cpp b/libi2pd/RouterInfo.cpp index f3639cf8..be2a5904 100644 --- a/libi2pd/RouterInfo.cpp +++ b/libi2pd/RouterInfo.cpp @@ -264,6 +264,8 @@ namespace data introducer.iTag = boost::lexical_cast(value); else if (!strcmp (key, "ikey")) Base64ToByteStream (value, strlen (value), introducer.iKey, 32); + else if (!strcmp (key, "iexp")) + introducer.iExp = boost::lexical_cast(value); } if (!s) return; } @@ -478,6 +480,18 @@ namespace data properties << ';'; i++; } + i = 0; + for (const auto& introducer: address.ssu->introducers) + { + if (introducer.iExp) // expiration is specified + { + WriteString ("iexp" + boost::lexical_cast(i), properties); + properties << '='; + WriteString (boost::lexical_cast(introducer.iExp), properties); + properties << ';'; + } + i++; + } } // write intro key WriteString ("key", properties); diff --git a/libi2pd/RouterInfo.h b/libi2pd/RouterInfo.h index 7300e579..f23fb152 100644 --- a/libi2pd/RouterInfo.h +++ b/libi2pd/RouterInfo.h @@ -73,10 +73,12 @@ namespace data typedef Tag<32> IntroKey; // should be castable to MacKey and AESKey struct Introducer { + Introducer (): iExp (0) {}; boost::asio::ip::address iHost; int iPort; IntroKey iKey; uint32_t iTag; + uint32_t iExp; }; struct SSUExt