Beispiel #1
0
        internal void IntroductionRelayOffered(IntroducerInfo intro)
        {
            if (!RouterContext.Inst.IsFirewalled)
            {
                if (CurrentIntroducers.Count() == 0)
                {
                    MyRouterContext.NoIntroducers();
                }
                return;
            }

            if (CurrentIntroducers.Count() >= 3)
            {
                return;
            }

            CurrentIntroducers.Set(intro.Host, intro);
            MyRouterContext.SetIntroducers(CurrentIntroducers.Select(i => i.Value));
        }
Beispiel #2
0
        internal void IntroductionRelayOffered(IntroducerInfo intro)
        {
            if (!RouterContext.Inst.IsFirewalled)
            {
                if (!CurrentIntroducers.Any())
                {
                    MyRouterContext.NoIntroducers();
                }
                return;
            }

            if (CurrentIntroducers.Count() >= 5)
            {
                return;
            }

            Logging.LogTransport($"SSU Introduction: Added introducer {intro.Host}, {intro.IntroKey}, {intro.IntroTag}, {intro.EndPoint}");
            CurrentIntroducers.Set(intro.Host, intro);
            MyRouterContext.SetIntroducers(CurrentIntroducers.Select(i => i.Value));
        }
Beispiel #3
0
        public Garlic DecryptMessage(GarlicMessage message)
        {
            var egdata = message.EGData;

            var(aesblock, sessionkey) = Garlic.RetrieveAESBlock(
                message,
                PrivateKey,
                (stag) =>
            {
                return(SessionTags.TryRemove(stag, out var sessionkeyfound) ? sessionkeyfound : null);
            });

            if (aesblock is null)
            {
                Logging.LogDebug($"{Owner} ReceivedSessions: Aes block decrypt failed.");
                return(null);
            }

#if LOG_ALL_LEASE_MGMT
            Logging.LogDebug($"{Owner} ReceivedSessions: Working Aes block received. {SessionTags.Count()} tags available.");
#endif

            if (sessionkey != null && aesblock.Tags.Count > 0)
            {
#if LOG_ALL_LEASE_MGMT
                Logging.LogDebug($"{Owner} ReceivedSessions: {aesblock.Tags.Count} new tags received.");
#endif
                foreach (var onetag in aesblock.Tags)
                {
                    SessionTags[new I2PSessionTag(new BufRef(onetag))] =
                        sessionkey;
                }
            }

            return(new Garlic((BufRefLen)aesblock.Payload));
        }