예제 #1
0
 /// <summary>
 /// The is running.
 /// </summary>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 public static bool IsRunning()
 {
     if (!Tun2Socks.IsTun2SocksRunning() || !Dns2Socks.IsDns2SocksRunning())
     {
         Tun2Socks.StopTun2Socks();
         Tun2Socks.CleanAllTun2Socks();
         Dns2Socks.StopDns2Socks();
         Dns2Socks.CleanAllDns2Socks();
         return(false);
     }
     return(true);
 }
예제 #2
0
 /// <summary>
 /// The stop tunnel.
 /// </summary>
 public static void StopTunnel()
 {
     Tun2Socks.StopTun2Socks();
     Tun2Socks.CleanAllTun2Socks();
     Dns2Socks.StopDns2Socks();
     Dns2Socks.CleanAllDns2Socks();
     foreach (
         IP4RouteTable ip4 in
         IP4RouteTable.GetCurrentTable()
         .Where(
             ip4 =>
             ExceptionIPs.Any(
                 ip =>
                 ip4.Destination != null && ip4.NextHop != null && ip4.Mask != null &&
                 ip4.Destination == ip.ToString() && ip4.Mask == "255.255.255.255" &&
                 ip4.NextHop != "0.0.0.0")))
     {
         ip4.RemoveRouteRule();
     }
 }