Пример #1
0
        private void TestNat(Simulator sim, NatTypes n0type0, NatTypes n0type1,
                             NatTypes n1type0, NatTypes n1type1, bool relay)
        {
            string fail_s = String.Format("{0}/{1} and {2}/{3}", n0type0, n0type1,
                                          n1type0, n1type1);
            Node node0 = null;
            Node node1 = null;

            while (true)
            {
                node0 = NatFactory.AddNode(sim, n0type0, n0type1, relay);
                node1 = NatFactory.AddNode(sim, n1type0, n1type1, relay);

                Assert.IsTrue(sim.Complete(true), fail_s + " nodes are connected to the overlay");
                if (!Simulator.AreConnected(node0, node1))
                {
                    break;
                }
            }

            ManagedConnectionOverlord mco = new ManagedConnectionOverlord(node0);

            mco.Start();
            node0.AddConnectionOverlord(mco);
            mco.Set(node1.Address);

            Assert.IsTrue(AreConnected(node0, node1), fail_s + " nodes were unable to connect.");
        }
Пример #2
0
        protected Result SymToRstAndAndOutOnlyToPublic()
        {
            Simulator sim   = new Simulator(_parameters);
            Node      node0 = NatFactory.AddNode(sim, NatTypes.Symmetric, NatTypes.OutgoingOnly, true);
            Node      node1 = NatFactory.AddNode(sim, NatTypes.RestrictedCone, NatTypes.Public, true);

            return(DoNatTest(sim, node0, node1));
        }
Пример #3
0
        protected Result Restricted()
        {
            Simulator sim   = new Simulator(_parameters);
            Node      node0 = NatFactory.AddNode(sim, NatTypes.RestrictedCone, NatTypes.Disabled, false);
            Node      node1 = NatFactory.AddNode(sim, NatTypes.RestrictedCone, NatTypes.Disabled, false);

            return(DoNatTest(sim, node0, node1));
        }