示例#1
0
        public void TestParseEntryIp()
        {
            var set = IpSetSet.Parse("test_set hash:ip family inet hashsize 10 maxelem 14", null);

            IpSetSets sets = new IpSetSets(null);

            sets.AddSet(set);


            String toParse = "test_set 1.2.3.4";
            var    entry   = IpSetEntry.Parse(toParse, sets);

            Assert.AreEqual("test_set", entry.Set.Name);
            Assert.AreEqual(IPAddress.Parse("1.2.3.4"), entry.Cidr.Address);
        }
示例#2
0
        public void TestParseEntry2()
        {
            var set = IpSetSet.Parse("test_set hash:ip,port family inet hashsize 10 maxelem 14", null);

            IpSetSets sets = new IpSetSets(null);

            sets.AddSet(set);


            String toParse = "test_set 8.8.8.8,tcp:80";
            var    entry   = IpSetEntry.Parse(toParse, sets);

            Assert.AreEqual("test_set", entry.Set.Name);
            Assert.AreEqual(IPAddress.Parse("8.8.8.8"), entry.Cidr.Address);
            Assert.AreEqual(80, entry.Port);
        }