@@ -921,11 +921,7 @@ private ScanSpeed getUploadTargetSpeed()
921921
922922 private void listResults_MouseDoubleClick ( object sender , MouseEventArgs e )
923923 {
924- var IPAddress = getSelectedIPAddress ( ) ;
925- if ( IPAddress != null )
926- {
927- testSingleIPAddress ( IPAddress ) ;
928- }
924+ testSelectedIP ( ) ;
929925 }
930926
931927 private void updateCFIPListStatusText ( )
@@ -1068,7 +1064,7 @@ private void scanASingleIPAddressToolStripMenuItem_Click(object sender, EventArg
10681064 string ipAddr ;
10691065 if ( getIPFromUser ( out ipAddr , "Test Single IP Address" ) )
10701066 {
1071- testAvgSingleIP ( ipAddr , 1 , getDownloadTargetSpeed ( ) , getSelectedV2rayConfig ( ) , getDownloadTimeout ( ) ) ;
1067+ testAvgSingleIP ( ipAddr , 1 , getDownloadTargetSpeed ( ) , getUploadTargetSpeed ( ) , getSelectedV2rayConfig ( ) , getDownloadTimeout ( ) , getSelectedCheckType ( ) ) ;
10721068 }
10731069 }
10741070
@@ -1455,31 +1451,33 @@ private void updateClientConfigCloudflareSubnetsToolStripMenuItem_Click(object s
14551451 }
14561452
14571453
1458- private void testAvgSingleIP ( string IPAddress , int rounds , ScanSpeed targetSpeed , CustomConfigInfo v2rayConfig , int downloadTimeout )
1454+ private void testAvgSingleIP ( string IPAddress , int rounds , ScanSpeed dlSpeed , ScanSpeed upSpeed , CustomConfigInfo v2rayConfig , int downloadTimeout , CheckType checkType = CheckType . DOWNLOAD )
14591455 {
14601456
1461- addTextLog ( $ "Testing { IPAddress } for { rounds } rounds...") ;
1457+ addTextLog ( $ "Testing { IPAddress } for { rounds } rounds, Scan Type: { checkType } ...") ;
14621458
14631459 int totalSuccessCount = 0 , totalFailedCount = 0 ;
1464- long bestDLDuration = 99999 , bestFrontingDuration = 99999 , totalDLDuration = 0 , totalFrontingDuration = 0 ;
1465- long averageDLDuration = 0 , averageFrontingDuration = 0 ;
1460+ long bestDLDuration = 99999 , bestUPDuration = 9999 , bestFrontingDuration = 99999 , totalDLDuration = 0 , totalUPDuration = 0 , totalFrontingDuration = 0 ;
1461+ long averageDLDuration = 0 , averageUPDuration = 0 , averageFrontingDuration = 0 ;
14661462
14671463 for ( int i = 1 ; i <= rounds ; i ++ )
14681464 {
14691465 // test
1470- // todo: set upload speed
1471- var checker = new CheckIPWorking ( IPAddress , targetSpeed , targetSpeed , v2rayConfig , getSelectedCheckType ( ) , downloadTimeout ) ;
1466+ var checker = new CheckIPWorking ( IPAddress , dlSpeed , upSpeed , v2rayConfig , checkType , downloadTimeout ) ;
14721467 var success = checker . check ( ) ;
14731468
14741469 long DLDuration = checker . downloadDuration ;
1470+ long UPDuration = checker . uploadDuration ;
14751471 long FrontingDuration = checker . frontingDuration ;
14761472
14771473 if ( success )
14781474 {
14791475 totalSuccessCount ++ ;
14801476 bestDLDuration = Math . Min ( DLDuration , bestDLDuration ) ;
1477+ bestUPDuration = Math . Min ( UPDuration , bestUPDuration ) ;
14811478 bestFrontingDuration = Math . Min ( FrontingDuration , bestFrontingDuration ) ;
14821479 totalDLDuration += DLDuration ;
1480+ totalUPDuration += UPDuration ;
14831481 totalFrontingDuration += FrontingDuration ;
14841482 }
14851483 else
@@ -1494,10 +1492,12 @@ private void testAvgSingleIP(string IPAddress, int rounds, ScanSpeed targetSpeed
14941492 if ( totalSuccessCount > 0 )
14951493 {
14961494 averageDLDuration = totalDLDuration / totalSuccessCount ;
1495+ averageUPDuration = totalUPDuration / totalSuccessCount ;
14971496 averageFrontingDuration = totalFrontingDuration / totalSuccessCount ;
14981497
14991498 string results = $ "{ IPAddress } => { totalSuccessCount } /{ rounds } was successful." + Environment . NewLine +
1500- $ "\t Download: Best { bestDLDuration : n0} ms, Average: { averageDLDuration : n0} ms" + Environment . NewLine +
1499+ ( bestDLDuration > 0 ? $ "\t Download: Best { bestDLDuration : n0} ms, Average: { averageDLDuration : n0} ms" + Environment . NewLine : "" ) +
1500+ ( bestUPDuration > 0 ? $ "\t Upload : Best { bestUPDuration : n0} ms, Average: { averageUPDuration : n0} ms" + Environment . NewLine : "" ) +
15011501 $ "\t Fronting: Best { bestFrontingDuration : n0} ms, Average: { averageFrontingDuration : n0} ms" + Environment . NewLine ;
15021502
15031503 addTextLog ( results ) ;
@@ -1509,23 +1509,6 @@ private void testAvgSingleIP(string IPAddress, int rounds, ScanSpeed targetSpeed
15091509
15101510 }
15111511
1512- private void testSingleIPAddress ( string IPAddress )
1513- {
1514- addTextLog ( $ "Testing { IPAddress } ...") ;
1515-
1516- var checker = new CheckIPWorking ( IPAddress , getDownloadTargetSpeed ( ) , getUploadTargetSpeed ( ) , getSelectedV2rayConfig ( ) , getSelectedCheckType ( ) , getDownloadTimeout ( ) ) ;
1517- var success = checker . check ( ) ;
1518-
1519- if ( success )
1520- {
1521- addTextLog ( $ "{ IPAddress } is working. Delay: { checker . downloadDuration : n0} ms.") ;
1522- }
1523- else
1524- {
1525- addTextLog ( $ "{ IPAddress } is NOT working.") ;
1526- }
1527- }
1528-
15291512 private void testSelectedIPAddresses ( int rounds = 1 )
15301513 {
15311514 if ( scanEngine . progressInfo . isScanRunning || isManualTesting )
@@ -1542,14 +1525,16 @@ private void testSelectedIPAddresses(int rounds = 1)
15421525 . ToArray < string > ( ) ; ;
15431526
15441527
1545- var speed = getDownloadTargetSpeed ( ) ;
1528+ var dlSpeed = getDownloadTargetSpeed ( ) ;
1529+ var upSpeed = getUploadTargetSpeed ( ) ;
1530+ var checkType = getSelectedCheckType ( ) ;
15461531 var conf = getSelectedV2rayConfig ( ) ;
15471532 var timeout = getDownloadTimeout ( ) ;
15481533
15491534 addTextLog ( $ "Start testing { selectedIPs . Length } IPs for { rounds } rounds..." + Environment . NewLine +
1550- $ "\t Test spec: download size: { speed . getTargetFileSizeInt ( timeout ) / 1000 } KB in { timeout } seconds." + Environment . NewLine ) ;
1535+ $ "\t Test spec: download size: { dlSpeed . getTargetFileSizeInt ( timeout ) / 1000 } KB in { timeout } seconds." + Environment . NewLine ) ;
15511536
1552- if ( speed . isSpeedZero ( ) )
1537+ if ( dlSpeed . isSpeedZero ( ) )
15531538 {
15541539 addTextLog ( "** Warning: Testing in NO VPN mode. Choose a target download speed from above settings so we can test base on that target speed." ) ;
15551540 }
@@ -1562,7 +1547,7 @@ private void testSelectedIPAddresses(int rounds = 1)
15621547 for ( int i = 0 ; i < selectedIPs . Length ; i ++ )
15631548 {
15641549 var ip = selectedIPs [ i ] ;
1565- testAvgSingleIP ( ip , rounds , speed , conf , timeout ) ;
1550+ testAvgSingleIP ( ip , rounds , dlSpeed , upSpeed , conf , timeout , checkType ) ;
15661551
15671552 // stop requested
15681553 if ( stopAvgTetingIsRequested )
@@ -1602,12 +1587,17 @@ private void btnResultsActions_Click(object sender, EventArgs e)
16021587 }
16031588
16041589 private void testThisIPAddressToolStripMenuItem_Click ( object sender , EventArgs e )
1590+ {
1591+ testSelectedIP ( ) ;
1592+ }
1593+
1594+ private void testSelectedIP ( )
16051595 {
16061596 var ip = getSelectedIPAddress ( ) ;
16071597
16081598 if ( ip != null )
16091599 {
1610- testAvgSingleIP ( ip , 1 , getDownloadTargetSpeed ( ) , getSelectedV2rayConfig ( ) , getDownloadTimeout ( ) ) ;
1600+ testAvgSingleIP ( ip , 1 , getDownloadTargetSpeed ( ) , getUploadTargetSpeed ( ) , getSelectedV2rayConfig ( ) , getDownloadTimeout ( ) , getSelectedCheckType ( ) ) ;
16111601 }
16121602 }
16131603
0 commit comments