Skip to content

Commit

Permalink
Merge pull request #548 from MortezaBashsiz/win-develop
Browse files Browse the repository at this point in the history
Win No Fronting option
  • Loading branch information
goingfine authored May 10, 2023
2 parents f4af3f5 + 374e792 commit 7df0e9e
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 32 deletions.
5 changes: 5 additions & 0 deletions windows/Classes/Checker/AbstractChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,10 @@ public enum CheckType
UPLOAD,
BOTH
}
public enum FrontingType
{
YES,
NO
}

}
7 changes: 5 additions & 2 deletions windows/Classes/Checker/CheckIPWorking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ internal class CheckIPWorking
private bool isDiagnosing = false;
public bool isV2rayExecutionSuccess = false;
public CheckType checkType { get; private set; }
public FrontingType frontingType { get; private set; }
private CheckResultStatus checkResultStatus;

public CheckIPWorking(string ip, ScanSpeed dlTargetSpeed, ScanSpeed upTargetSpeed, CustomConfigInfo scanConfig, CheckType checkType, int checkTimeout, bool isDiagnosing = false)
public CheckIPWorking(string ip, ScanSpeed dlTargetSpeed, ScanSpeed upTargetSpeed, CustomConfigInfo scanConfig,
CheckType checkType, FrontingType frontingType, int checkTimeout, bool isDiagnosing = false)
{
this.ip = ip;
port = getPortByIP();
Expand All @@ -44,6 +46,7 @@ public CheckIPWorking(string ip, ScanSpeed dlTargetSpeed, ScanSpeed upTargetSpee
this.checkTimeout = checkTimeout;
this.isDiagnosing = isDiagnosing;
this.checkType = checkType;
this.frontingType = frontingType;
checkResultStatus = new CheckResultStatus(checkType);
}

Expand All @@ -58,7 +61,7 @@ public bool check()
Tools.logStep("IP: " + ip, isDiagnosing);

// first of all quick test on fronting domain through cloudflare
bool frontingSuccess = checkFronting();
bool frontingSuccess = frontingType == FrontingType.YES || isDiagnosing ? checkFronting() : true;

if (frontingSuccess || isDiagnosing) // on diagnosing we will always test v2ray
{
Expand Down
14 changes: 13 additions & 1 deletion windows/Classes/Config/ScanResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,14 @@ public bool loadPlain()

string plainString = File.ReadAllText(resultsFileName);
long DLDelay = 0, UPDelay = 0; string ip;
foreach(var line in plainString.Split(Environment.NewLine))

var lines = plainString.Split(Environment.NewLine);

if (lines.Length == 1 ) { // support old format: LF only
lines = plainString.Split("\n");
}

foreach (var line in lines)
{
ip = line;
// DL UP IP
Expand All @@ -89,6 +96,11 @@ public bool loadPlain()
long.TryParse(splited[1], out UPDelay);
ip = splited[2];
}
else if(splited.Length == 2) // old format, dl only
{
long.TryParse(splited[0], out DLDelay);
ip = splited[1];
}
}

if(IPAddressExtensions.isValidIPAddress(ip))
Expand Down
3 changes: 2 additions & 1 deletion windows/Classes/ScanEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ internal class ScanEngine
public bool isV2rayExecutionSuccess { get; private set; }
public ScanSpeed upTargetSpeed { get; set; }
public CheckType checkType { get; set; }
public FrontingType frontingType { get; set; }

public int concurrentProcess = 4;
public ScanSpeed dlTargetSpeed;
Expand Down Expand Up @@ -244,7 +245,7 @@ private void parallelScan(List<string> ipRange)
{
progressInfo.curentWorkingThreads++;
}
var checker = new CheckIPWorking(ip, dlTargetSpeed, this.upTargetSpeed, scanConfig, this.checkType, checkTimeout, isDiagnosing);
var checker = new CheckIPWorking(ip, dlTargetSpeed, this.upTargetSpeed, scanConfig, this.checkType, frontingType, checkTimeout, isDiagnosing);
bool isOK = checker.check();

lock (locker)
Expand Down
2 changes: 1 addition & 1 deletion windows/Properties/latest-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v:1.1.8506.21097
v:1.2.8530.30281
2 changes: 1 addition & 1 deletion windows/WinCFScan.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<AssemblyVersion>1.1.*</AssemblyVersion>
<AssemblyVersion>1.2.*</AssemblyVersion>
<Deterministic>false</Deterministic>
<Platforms>AnyCPU;x86</Platforms>
<ApplicationIcon>WinCFScan.ico</ApplicationIcon>
Expand Down
55 changes: 34 additions & 21 deletions windows/frmMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7df0e9e

Please sign in to comment.