From 6623c6f9f1316923ec2b9bc692413dd089789503 Mon Sep 17 00:00:00 2001 From: thepra Date: Thu, 15 Oct 2026 11:36:14 +0200 Subject: [PATCH] me-web? 0.5.1: the route from the server back to you arrives - With the test from outside, the route from the publisher's server back to your address came back empty: the trace program holds its output until it ends, and it was stopped first while waiting on routers that never answer. It now reports each router as soon as it answers and stops after three silent ones, so the routers in front of your provider's exit reach the app. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012CzABvBkbcFqoHdmi8b9WB --- Directory.Build.props | 2 +- src/MeWeb.Server/ProbeService.cs | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index 446456e..71e49a5 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,6 +1,6 @@ - 0.5.0 + 0.5.1 me-web? Arasaka di Hvozdikov Yevheniy © 2026 Arasaka di Hvozdikov Yevheniy diff --git a/src/MeWeb.Server/ProbeService.cs b/src/MeWeb.Server/ProbeService.cs index 023cca9..8d0fa19 100644 --- a/src/MeWeb.Server/ProbeService.cs +++ b/src/MeWeb.Server/ProbeService.cs @@ -95,18 +95,21 @@ public partial class ProbeService(IOptionsMonitor options, ILogger await tracing.WaitAsync(ct); try { - var info = new ProcessStartInfo("tracepath") { RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false }; - foreach (var argument in new[] { "-n", "-m", "16", target.ToString() }) info.ArgumentList.Add(argument); + var info = new ProcessStartInfo("stdbuf") { RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false }; + foreach (var argument in new[] { "-oL", "tracepath", "-n", "-m", "16", target.ToString() }) info.ArgumentList.Add(argument); using var process = Process.Start(info); if (process is null) return hops; using var timeout = CancellationTokenSource.CreateLinkedTokenSource(ct); timeout.CancelAfter(TimeSpan.FromSeconds(25)); try { + var silent = 0; while (await process.StandardOutput.ReadLineAsync(timeout.Token) is { } line) { + if (SilentLine().IsMatch(line) && ++silent >= 3) break; var match = HopLine().Match(line); if (!match.Success || !IPAddress.TryParse(match.Groups[2].Value, out var address)) continue; + silent = 0; var distance = int.Parse(match.Groups[1].Value, CultureInfo.InvariantCulture); if (hops.Any(h => h.Distance == distance)) continue; if (!IsPublic(address) || Refuse(address) is not null) continue; @@ -148,6 +151,9 @@ public partial class ProbeService(IOptionsMonitor options, ILogger [GeneratedRegex(@"^\s*(\d+):\s+([0-9a-fA-F.:]+)\s+([\d.]+)ms")] internal static partial Regex HopLine(); + [GeneratedRegex(@"^\s*\d+:\s+no reply")] + internal static partial Regex SilentLine(); + async Task Knock(Ticket ticket, int port, CancellationToken ct) { await outbound.WaitAsync(ct);