Exemple #1
0
        public void TestIpRange()
        {
            IpRange range = new IpRange("148.81.0.0/16");

            Assert.That(range.GetFrom().ToString(), Is.EqualTo("148.81.0.0"));
            Assert.That(range.GetTo().ToString(), Is.EqualTo("148.81.255.255"));
        }
Exemple #2
0
    public IEnumerable <string> GetIPRange(IpRange range)
    {
        uint sIP = IpToUint(range.GetFrom().GetAddressBytes());
        uint eIP = IpToUint(range.GetTo().GetAddressBytes());

        while (sIP <= eIP)
        {
            yield return(new IPAddress(ReverseBytesArray(sIP)).ToString());

            sIP++;
        }
    }