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); }
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); }