Skip to content

feat(torrent): report torrent peers' client names on live connections - #576

Merged
linroid merged 2 commits into
mainfrom
feat/torrent-peer-client
Oct 17, 2026
Merged

linroid merged 2 commits into
mainfrom
feat/torrent-peer-client

Conversation

@linroid

@linroid linroid commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Summary

Torrent peers' handshakes already carry who they are, but Ketch dropped it. Live connections now report the remote client:

  • PeerDetails.client (library:api, nullable, display only, self-reported).
  • PeerClients (library:torrent) decodes 20-byte peer IDs: Azureus style (-qB4630- → qBittorrent 4.6.3, ~90 codes incl. KE = Ketch), Shadow style and Mainline style; unknown IDs → null.
  • PeerExtensions reads BEP 10 v, stripped of control and formatting (bidi) characters and cut to 64 chars; it replaces the peer-ID guess once the extension handshake arrives.
  • PeerTraffic.open(peerId = …) and PeerTraffic.client(name), wired into the v1 swarm workers and the v2/hybrid session loop. Client names go to the connection reporter only, never to logs with hosts (ConnectionSpec.toString still leaves the peer out).
  • Server /api/connections and the event stream serialize ActiveConnection, so the field flows through unchanged; older clients ignore it.
  • App Connections page: a Client column (shown while torrent peers are connected, dropped by fitColumns after Peer and Route), sortable with unknown clients last; narrow rows lead their second line with the client; search matches clients. String translated into all 9 locales.

Snapshots

Before After

Tests

  • PeerClientsTest: Azureus/Shadow/Mainline decoding, our own peer ID, unknown IDs, v sanitizing (control, bidi, length, surrogate pairs).
  • TorrentPeerConnectionsTest: an incoming v1 peer reports the client from its peer ID, then its v; client() describes only on change.
  • ConnectionRowsTest: search by client, client sort.
  • Ran :library:api:jvmTest, :library:server:test, :library:remote:jvmTest, :library:torrent:jvmTest, :library:torrent:compileTestKotlinIosSimulatorArm64, :app:shared:jvmTest: all pass. API dump updated.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T15:17:40.829119Z 00c39c9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Oct 17, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.


🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00c39c9c8d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@linroid
linroid merged commit 3359d13 into main Oct 17, 2026
11 checks passed
@linroid
linroid deleted the feat/torrent-peer-client branch October 17, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant