Пример #1
0
        public static string GetValidLoginUrl()
        {
            ShadowsocksController controller = new ShadowsocksController();
            Configuration         config     = controller.GetCurrentConfiguration();

            if (config.isDefaultConfig())
            {
                string testUrl = Configuration.GetDefaultUrl(0);
                if (ConnectTest.canUrlConnect(testUrl + "/mod_mu/func/ping", "ret", false))
                {
                    return(testUrl);
                }
                else
                {
                    testUrl = Configuration.GetDefaultUrl(1);
                    if (ConnectTest.canUrlConnect(testUrl + "/mod_mu/func/ping", "ret", false))
                    {
                        return(testUrl);
                    }
                }
            }
            else
            {
                string testUrl = config.ApiUrl;
                if (ConnectTest.canUrlConnect(testUrl + "/mod_mu/func/ping", "ret", false))
                {
                    return(testUrl);
                }
                else if (ConnectTest.canUrlConnect(testUrl + "/mod_mu/func/ping", "ret", true))
                {
                    return(testUrl);
                }
                else
                {
                    testUrl = Configuration.GetDefaultUrl(0);
                    if (ConnectTest.canUrlConnect(testUrl + "/mod_mu/func/ping", "ret", false))
                    {
                        return(testUrl);
                    }
                    else if (ConnectTest.canUrlConnect(testUrl + "/mod_mu/func/ping", "ret", true))
                    {
                        return(testUrl);
                    }
                    else
                    {
                        testUrl = Configuration.GetDefaultUrl(1);
                        if (ConnectTest.canUrlConnect(testUrl + "/mod_mu/func/ping", "ret", false))
                        {
                            return(testUrl);
                        }
                        else if (ConnectTest.canUrlConnect(testUrl + "/mod_mu/func/ping", "ret", true))
                        {
                            return(testUrl);
                        }
                    }
                }
            }
            return("");
        }
Пример #2
0
 public static bool canLocalSocks5ProxyConnectBaidu()
 {
     if (!ConnectTest.isValidCurrentServer())
     {
         return(false);
     }
     return(ConnectTest.canUrlConnect("http://www.baidu.com", "html", true));
 }
Пример #3
0
 public static bool canLocalSocks5ProxyConnectGoogle()
 {
     if (!ConnectTest.isValidCurrentServer())
     {
         return(false);
     }
     return(ConnectTest.canUrlConnect("http://chrome.google.com", "html", true));
 }
Пример #4
0
        public static bool isValidCurrentServer()
        {
            ShadowsocksController controller = new ShadowsocksController();
            Configuration         config     = controller.GetCurrentConfiguration();
            int i = config.index;

            return(ConnectTest.isValidServerPort(config.configs[i].server, config.configs[i].server_port));
        }
Пример #5
0
 public static bool isValidLocalSocks5Proxy()
 {
     return(ConnectTest.canLocalSocks5ProxyConnectBaidu());
 }