Skip to content

Commit

Permalink
ensure http response is from cloudflare
Browse files Browse the repository at this point in the history
  • Loading branch information
DevoTalk committed Jun 9, 2024
1 parent 0d21924 commit 6445b23
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions fast cf ip scanner/Services/IPService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task<List<IPModel>> GetIpValid(string[] ips, IpOptionModel ipOption
var validIps = new List<IPModel>();
switch (protcol)
{
case "Http test":
case "Http test (recommended)":
validIps = await GetValidٌIPWithHttpTest(ips, ipOptions);
break;

Expand Down Expand Up @@ -73,9 +73,12 @@ async Task HttpTest(string ipAddresse)

if (result != null)
{
if (!ports.Any(p => p == port))
if (result.Headers.Contains("Server") && result.Headers.GetValues("Server").Contains("cloudflare"))
{
ports.Add(port);
if (!ports.Any(p => p == port))
{
ports.Add(port);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion fast cf ip scanner/ViewModels/ScanPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public ScanPageViewModel(IPService iPServices, WorkerService workerService)
[RelayCommand]
async void GetValidIPs()
{
var protocols = new string[] { "Http test", "TCP test", "Terminal Ping test" };
var protocols = new string[] { "Http test (recommended)", "TCP test", "Terminal Ping test" };

var selectedProtocol =
await App.Current.MainPage.DisplayActionSheet("which protocol", "Cancel", null, protocols);
Expand Down

0 comments on commit 6445b23

Please sign in to comment.