-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProxy.cs
46 lines (42 loc) · 1.32 KB
/
Proxy.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using ProxyChecker.Settings;
using System.Net;
namespace ProxyFinderAndChecker
{
public class Proxy
{
public string CheckProxy(WebProxy proxy)
{
try
{
var data = "";
using (var client = new HttpClient(handler: new HttpClientHandler() { Proxy = proxy }))
{
client.Timeout = TimeSpan.FromSeconds(SettingFileConfigure.GetTimeOut());
data = client.GetStringAsync("http://ip-api.com/json").GetAwaiter().GetResult();
}
return data;
}
catch
{
return "Error";
}
}
}
public class CheckedProxyData
{
public string status { get; set; }
public string country { get; set; }
public string countryCode { get; set; }
public string region { get; set; }
public string regionName { get; set; }
public string city { get; set; }
public string zip { get; set; }
public double lat { get; set; }
public double lon { get; set; }
public string timezone { get; set; }
public string isp { get; set; }
public string org { get; set; }
public string @as { get; set; }
public string query { get; set; }
}
}