private Enums.ProxyStatus GetProxyStatus() { Enums.ProxyStatus proxy = Enums.ProxyStatus.Ok; var ping = new Ping(); var reply = ping.Send(this.proxy.Address); if (reply.Status != IPStatus.Success) { proxy = Enums.ProxyStatus.Dead; } return(proxy); }
public Client(Classes.Proxy proxy, string myIP) { this.proxy = proxy; this.myIP = myIP; this.webProxy = new WebProxy() { Address = new Uri($"http://{this.proxy.Address}:{this.proxy.Port}"), BypassProxyOnLocal = false, UseDefaultCredentials = false, }; if (!string.IsNullOrEmpty(this.proxy.Id)) { webProxy.Credentials = new NetworkCredential(userName: this.proxy.Id, password: this.proxy.Password); } clientHandler = new HttpClientHandler() { Proxy = this.webProxy, UseProxy = true, AllowAutoRedirect = true }; this.client = new HttpClient(clientHandler); this.client.Timeout = TimeSpan.FromSeconds(10); }