Skip to content

Commit 9fe891d

Browse files
committed
SanProxy
1 parent e112c74 commit 9fe891d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Demo/Program.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,16 @@ static void Main(string[] args)
2828
/// </summary>
2929
static async void ScanProxy()
3030
{
31-
var proxys = HttpProxy.Range(IPAddress.Parse("221.122.13.1"), 8080, 9999).ToArray();
3231
var target = new Uri("http://www.baidu.com");
32+
var proxys = HttpProxy.Range(IPAddress.Parse("221.122.13.1"), 8080, 9999);
33+
3334
var tasks = proxys.Select(async p =>
3435
{
3536
Interlocked.Increment(ref totalProxyCount);
36-
var state = await ProxyValidator.ValidateAsync(p, target, TimeSpan.FromMilliseconds(500d));
37-
if (state == HttpStatusCode.OK)
37+
if (await ProxyValidator.ValidateAsync(p, target, TimeSpan.FromMilliseconds(500d)) == HttpStatusCode.OK)
3838
{
3939
Console.WriteLine($"扫描到代理服务:{p.Host}:{p.Port}");
4040
}
41-
4241
var completed = Interlocked.Increment(ref completedProxyCount);
4342
Console.Title = $"扫描进度:{completed}/{Interlocked.Read(ref totalProxyCount)}";
4443
});

0 commit comments

Comments
 (0)