From 4b133594ad7da3daaf7b56c372d987e5ae02bc81 Mon Sep 17 00:00:00 2001 From: lighting9999 Date: Mon, 30 Nov 2026 23:10:57 +0800 Subject: [PATCH 1/3] fix: accept valid announce responses without peers --- trackerchecker.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/trackerchecker.cs b/trackerchecker.cs index ef6052e..c0a1e83 100644 --- a/trackerchecker.cs +++ b/trackerchecker.cs @@ -1353,7 +1353,6 @@ internal static bool BdecodeSimple(ReadOnlySpan data) var pos = 1; var hasInterval = false; - var hasPeers = false; var hasFailureReason = false; while (pos < data.Length && data[pos] != (byte)'e') @@ -1388,7 +1387,6 @@ internal static bool BdecodeSimple(ReadOnlySpan data) if (!SkipBencodeValue(data, ref pos, 0)) return false; } else return false; - hasPeers = true; continue; } @@ -1397,7 +1395,6 @@ internal static bool BdecodeSimple(ReadOnlySpan data) if (!char.IsAsciiDigit((char)data[pos]) || !TryReadBencodeString(data, ref pos, out var peers6) || peers6.Length % 18 != 0) return false; - hasPeers = true; continue; } @@ -1406,7 +1403,9 @@ internal static bool BdecodeSimple(ReadOnlySpan data) } // A failure reason is an explicit tracker rejection, never an ALIVE response. - return !hasFailureReason && hasInterval && hasPeers && + // Trackers may omit peers when numwant=0 or when no peers are available. + // Any peer payload that is present is still validated above. + return !hasFailureReason && hasInterval && pos == data.Length - 1 && data[pos] == (byte)'e'; } From 8f10b4e2cdd5952fadef2a6c0afacf7027e053ed Mon Sep 17 00:00:00 2001 From: lighting9999 Date: Mon, 30 Nov 2026 23:11:05 +0800 Subject: [PATCH 2/3] test: cover announce responses without peer payloads --- .../ProtocolRegressionTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/TrackerChecker.Tests/ProtocolRegressionTests.cs b/tests/TrackerChecker.Tests/ProtocolRegressionTests.cs index a589c8d..0a93c37 100644 --- a/tests/TrackerChecker.Tests/ProtocolRegressionTests.cs +++ b/tests/TrackerChecker.Tests/ProtocolRegressionTests.cs @@ -16,6 +16,24 @@ public void Bencode_ValidAnnounceResponse_IsAccepted() Assert.True(global::TrackerChecker.TrackerChecker.BdecodeSimple(response)); } + [Fact] + public void Bencode_AnnounceResponseWithoutPeers_IsAccepted() + { + // numwant=0 trackers may omit peers entirely while still accepting + // the announce and returning a valid interval. + var response = Encoding.ASCII.GetBytes("d8:intervali180ee"); + + Assert.True(global::TrackerChecker.TrackerChecker.BdecodeSimple(response)); + } + + [Fact] + public void Bencode_InvalidCompactPeerLength_IsRejected() + { + var response = Encoding.ASCII.GetBytes("d8:intervali180e5:peers1:xe"); + + Assert.False(global::TrackerChecker.TrackerChecker.BdecodeSimple(response)); + } + [Fact] public void Bencode_FailureReason_IsRejected() { From 1a4ed31816db4362d442ef00d959fdfa9d77efc7 Mon Sep 17 00:00:00 2001 From: lighting9999 Date: Mon, 30 Nov 2026 23:11:11 +0800 Subject: [PATCH 3/3] fix: keep public tracker checks off the i2pd SOCKS proxy --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9ce35be..9e05b3a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -134,7 +134,6 @@ jobs: -retries 2 \ -compact0-fallback \ -insecure \ - -proxy socks5://localhost:4444 \ -sam \ -doh-servers "https://cloudflare-dns.com/dns-query,https://dns.google/dns-query,https://doh.dns.sb/dns-query" \ -dns-timeout 5s \