示例#1
0
 public IPForwardRow(RouteTableManager.MIB_IPFORWARDROW baseStruct)
 {
     Dest      = RouteTableManager.UintToIp(baseStruct.dwForwardDest);
     Mask      = RouteTableManager.UintToIp(baseStruct.dwForwardMask);
     Policy    = baseStruct.dwForwardPolicy;
     NextHop   = RouteTableManager.UintToIp(baseStruct.dwForwardNextHop);
     IfIndex   = baseStruct.dwForwardIfIndex;
     Type      = baseStruct.dwForwardType;
     Proto     = baseStruct.dwForwardProto;
     Age       = baseStruct.dwForwardAge;
     NextHopAS = baseStruct.dwForwardNextHopAS;
     Metric    = baseStruct.dwForwardMetric1;
 }
示例#2
0
 public RouteTableManager.MIB_IPFORWARDROW GetBaseStruct()
 {
     return(new RouteTableManager.MIB_IPFORWARDROW()
     {
         dwForwardDest = RouteTableManager.IpToUint(Dest),
         dwForwardMask = RouteTableManager.IpToUint(Mask),
         dwForwardPolicy = Policy,
         dwForwardNextHop = RouteTableManager.IpToUint(NextHop),
         dwForwardIfIndex = IfIndex,
         dwForwardType = Type,
         dwForwardProto = Proto,
         dwForwardAge = Age,
         dwForwardNextHopAS = NextHopAS,
         dwForwardMetric1 = Metric,
         dwForwardMetric2 = -1,
         dwForwardMetric3 = -1,
         dwForwardMetric4 = -1,
         dwForwardMetric5 = -1
     });
 }
示例#3
0
        public static void Main(string[] args)
        {
            // test();
            //StreamReader sr = new StreamReader("c:\\users\\zyl\\desktop\\xv\\a.csv", Encoding.Default);
            //String line ="";
            //string allString = "";

            //while ((line = sr.ReadLine()) != "")
            //{
            //    allString += line+"\n";

            //}
            //Write("c:\\users\\zyl\\desktop\\xv\\" + 0.ToString()+ ".txt", allString);
            //for (int i = 1; i < 3000; i++)
            //{
            //    line = sr.ReadLine();
            //    allString = "";
            //    while ((line = sr.ReadLine()) != "")
            //    {
            //        allString += line + "\n";

            //    }

            //    Write("c:\\users\\zyl\\desktop\\xv\\" + i.ToString() + ".txt", allString);
            //}



            // Console.ReadKey();
            //Cryptography cryptography = new Cryptography();
            //var des=cryptography.DecryptDES("IyHrl0HP5iI=");
            //Db2Word.Instance("dbconn2").Start();
            //testC.Instance.Start();
            //testC.Instance.Start();
            //Db2Word db2Word= new Db2Word();
            // db2Word.Start();
            //     var y = test();


            //SpiderShadowsocks spider2 = new SpiderShadowsocks();
            //spider2.Start();

            SpiderChinaIp     spider = new SpiderChinaIp();
            List <RouteModel> list   = spider.Start();


            Console.WriteLine("开始创建路由..大概需要1分钟...");

            list.AsEnumerable().Select(route =>
            {
                // RouteTableManager.DeleteIpForwardEntry(IPAddress.Parse(route.Ip));
                // Console.WriteLine("创建路由" + route.Ip);
                RouteTableManager.CreateIpForwardEntry(
                    IPAddress.Parse(route.Ip),
                    IPAddress.Parse(route.Mask),
                    IPAddress.Parse(GateWay), 50);
                return(route);
            }).ToList();

            Console.WriteLine("创建完成..");
            Console.ReadKey();
        }