public void ReloadIPRange()
        {
            _rangeSet = new SegmentIPOrderList();
            _rangeSet.LoadChinaIP();

            _rangeSet.IsReverse = (_config.proxyRuleMode == (int)ProxyRuleMode.BypassLanAndNotChina);
        }
Exemple #2
0
        public void TestIPRangeQuery_new()
        {
            SegmentIPOrderList iprs = new SegmentIPOrderList();

            iprs.LoadChinaIP();

            Stopwatch sw = new Stopwatch();

            sw.Start();
            for (int i = 0; i < 100000; i++)
            {
                {
                    var rst = iprs.IsInList(IPAddress.Parse("203.57.200.1"));
                    Assert.IsTrue(rst);
                }
                {
                    var rst = iprs.IsInList(IPAddress.Parse("202.0.184.1"));
                    Assert.IsFalse(rst);
                }
            }
            sw.Stop();
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
        }