Example #1
0
        //private async Task<bool> Login()
        //{
        //    Console.Write("Username: "******"Password: "******"network"));
                    uris = await proxyListLoader.LoadAsync(_ctx);
                }
                catch (Exception e)
                {
                    throw new Exception("Could not get the server network", e);
                }

                var sb = new StringBuilder();
                sb.AppendLine("Available server:");

                foreach (var i in uris)
                {
                    sb.AppendLine($"- {i}");
                }

                Logger.Info(sb.ToString());

                try
                {
                    var fastest = await PingTest.GetBestPing(uris);

                    Logger.Info($"Fastest server: {fastest.Item1} -> {(int)fastest.Item2.TotalMilliseconds} ms");
                    return(fastest);
                }
                catch (Exception e)
                {
                    throw new Exception("Error while doing the ping speed test", e);
                }
            }
            catch (Exception e)
            {
                throw new Exception("Could not determine the fastest proxy", e);
            }
        }