-
Notifications
You must be signed in to change notification settings - Fork 0
Require MTR pass for path success; gate target scoring and add explicit per-path MTR/ping logging #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Require MTR pass for path success; gate target scoring and add explicit per-path MTR/ping logging #22
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -219,15 +219,17 @@ ${error.stderr || ''}`; | |
| let score = 0; | ||
| if (results.sourcePing) score += 10; | ||
| if (results.sourcePort443) score += 10; | ||
| if (results.targetPing) score += 20; | ||
| if (results.port80) score += 20; | ||
| if (results.port443) score += 25; | ||
| if (results.port22) score += 7; | ||
| if (results.port53) score += 8; | ||
| if (results.tracerouteAvailable && results.tracerouteReachedTarget) score += 5; | ||
| if (results.mtrAvailable && results.mtrLossPercent !== null) { | ||
| if (results.mtrLossPercent <= 5) score += 5; | ||
| else if (results.mtrLossPercent <= 20) score += 2; | ||
| if (results.targetPing) { | ||
| score += 20; | ||
| if (results.port80) score += 20; | ||
| if (results.port443) score += 25; | ||
| if (results.port22) score += 7; | ||
| if (results.port53) score += 8; | ||
| if (results.tracerouteAvailable && results.tracerouteReachedTarget) score += 5; | ||
| if (results.mtrAvailable && results.mtrLossPercent !== null) { | ||
| if (results.mtrLossPercent <= 5) score += 5; | ||
| else if (results.mtrLossPercent <= 20) score += 2; | ||
| } | ||
| } | ||
| results.targetReachability = Math.min( | ||
| 100, | ||
|
|
@@ -305,23 +307,26 @@ ${error.stderr || ''}`; | |
|
|
||
| const testResults = await this.runWithConcurrency(tasks, this.maxConcurrent); | ||
| testResults.filter(Boolean).forEach((result) => { | ||
| if (result.connectivityScore > 0) { | ||
| const isMtrPassed = result.stageResults?.mtr === 'passed'; | ||
| const pingStats = result.targetPingStats || {}; | ||
| const pingBadge = (pingStats.transmitted !== null && pingStats.received !== null) | ||
| ? `{ping ${pingStats.received}/${pingStats.transmitted}}` | ||
| : '{ping N/A}'; | ||
| const latencyBadge = pingStats.averageLatencyMs !== null | ||
| ? `{latency ${pingStats.averageLatencyMs} ms}` | ||
| : '{latency N/A}'; | ||
|
|
||
| if (isMtrPassed) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This branch makes Useful? React with 👍 / 👎. |
||
| providerResults.successfulConnections.push(result); | ||
| if (!providerResults.bestConnection || | ||
| result.connectivityScore > providerResults.bestConnection.connectivityScore) { | ||
| providerResults.bestConnection = result; | ||
| } | ||
| const pingStats = result.targetPingStats || {}; | ||
| const pingBadge = (pingStats.transmitted !== null && pingStats.received !== null) | ||
| ? `{ping ${pingStats.received}/${pingStats.transmitted}}` | ||
| : '{ping N/A}'; | ||
| const latencyBadge = pingStats.averageLatencyMs !== null | ||
| ? `{latency ${pingStats.averageLatencyMs} ms}` | ||
| : '{latency N/A}'; | ||
| this.log(`✓ Connection path score ${result.ip} -> ${this.targetIp} (${result.connectivityScore}) ${pingBadge} ${latencyBadge}`, 'success'); | ||
| this.log(`✓ Connection path score ${result.ip} -> ${this.targetIp} (${result.connectivityScore}) ${pingBadge} ${latencyBadge} {mtr ✓}`, 'success'); | ||
| } else { | ||
| providerResults.failedConnections.push(result); | ||
| this.log(`✗ Connection path failed ${result.ip} -> ${this.targetIp}`, 'error'); | ||
| const mtrState = result.stageResults?.mtr || 'skipped'; | ||
| this.log(`✗ Connection path failed ${result.ip} -> ${this.targetIp} ${pingBadge} ${latencyBadge} {mtr ${mtrState}}`, 'error'); | ||
| } | ||
| }); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Placing all target-side score terms behind
if (results.targetPing)drops the score for hosts that block ICMP but still have reachable TCP services (80/443/22/53), even though those ports are explicitly tested just above. In ICMP-filtered networks this under-scores actually reachable targets and distorts ranking/selection output; applying a ping penalty is reasonable, but zeroing all target-port contributions is a functional regression.Useful? React with 👍 / 👎.