[PR #28] Add isolated BitTorrent traffic detector #28

Open
opened 2026-10-13 21:11:02 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-xray-core/pull/28
Author: @FrogRocky
Created: 8/25/2026
Status: 🔄 Open

Base: master ← Head: frog/bittorrent-detector-module


📝 Commits (4)

  • f23ff02 feat(bittorrent): add isolated torrent detector
  • fc9b867 fix(bittorrent): ignore DNS collisions in uTP detection
  • ff5251d test(dispatcher): add bittorrent block process e2e
  • 2e51bd0 fix(bittorrent): cover deployed DNS query shapes

📊 Changes

13 files changed (+1617 additions, -3 deletions)

View changed files

➕ app/dispatcher/bittorrent_block_process_test.go (+620 -0)
📝 app/dispatcher/sniffer.go (+3 -3)
➕ app/dispatcher/sniffer_bittorrent_test.go (+69 -0)
➕ common/protocol/bittorrent/detector/detector.go (+42 -0)
➕ common/protocol/bittorrent/detector/detector_test.go (+95 -0)
➕ common/protocol/bittorrent/detector/dht.go (+261 -0)
➕ common/protocol/bittorrent/detector/dht_test.go (+67 -0)
➕ common/protocol/bittorrent/detector/tcp.go (+13 -0)
➕ common/protocol/bittorrent/detector/test_helpers_test.go (+162 -0)
➕ common/protocol/bittorrent/detector/tracker.go (+33 -0)
➕ common/protocol/bittorrent/detector/tracker_test.go (+56 -0)
➕ common/protocol/bittorrent/detector/utp.go (+74 -0)
➕ common/protocol/bittorrent/detector/utp_test.go (+122 -0)

📄 Description

Adds an isolated compile-time BitTorrent detector and replaces the existing dispatcher registrations with it.

Detects plaintext TCP handshakes, uTP, DHT and UDP tracker traffic while preserving DNS, WireGuard and QUIC negative cases. Existing protocol-based routing and blackhole rules continue to work without config, API or dependency changes.

Tests:

  • go test -timeout 1h ./...
  • detector race test and vet
  • dispatcher process E2E

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amnezia-xray-core/pull/28 **Author:** [@FrogRocky](https://github.com/FrogRocky) **Created:** 8/25/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `frog/bittorrent-detector-module` --- ### 📝 Commits (4) - [`f23ff02`](https://github.com/amnezia-vpn/amnezia-xray-core/commit/f23ff020e3211783e9bbd2697526a82b52890cca) feat(bittorrent): add isolated torrent detector - [`fc9b867`](https://github.com/amnezia-vpn/amnezia-xray-core/commit/fc9b8675340331d50e146acc98d1f07fb425455b) fix(bittorrent): ignore DNS collisions in uTP detection - [`ff5251d`](https://github.com/amnezia-vpn/amnezia-xray-core/commit/ff5251d86989e04b102cab1c0f8cb2abd557885d) test(dispatcher): add bittorrent block process e2e - [`2e51bd0`](https://github.com/amnezia-vpn/amnezia-xray-core/commit/2e51bd04b103c6a8e10262a3e2997c1784305509) fix(bittorrent): cover deployed DNS query shapes ### 📊 Changes **13 files changed** (+1617 additions, -3 deletions) <details> <summary>View changed files</summary> ➕ `app/dispatcher/bittorrent_block_process_test.go` (+620 -0) 📝 `app/dispatcher/sniffer.go` (+3 -3) ➕ `app/dispatcher/sniffer_bittorrent_test.go` (+69 -0) ➕ `common/protocol/bittorrent/detector/detector.go` (+42 -0) ➕ `common/protocol/bittorrent/detector/detector_test.go` (+95 -0) ➕ `common/protocol/bittorrent/detector/dht.go` (+261 -0) ➕ `common/protocol/bittorrent/detector/dht_test.go` (+67 -0) ➕ `common/protocol/bittorrent/detector/tcp.go` (+13 -0) ➕ `common/protocol/bittorrent/detector/test_helpers_test.go` (+162 -0) ➕ `common/protocol/bittorrent/detector/tracker.go` (+33 -0) ➕ `common/protocol/bittorrent/detector/tracker_test.go` (+56 -0) ➕ `common/protocol/bittorrent/detector/utp.go` (+74 -0) ➕ `common/protocol/bittorrent/detector/utp_test.go` (+122 -0) </details> ### 📄 Description Adds an isolated compile-time BitTorrent detector and replaces the existing dispatcher registrations with it. Detects plaintext TCP handshakes, uTP, DHT and UDP tracker traffic while preserving DNS, WireGuard and QUIC negative cases. Existing protocol-based routing and blackhole rules continue to work without config, API or dependency changes. Tests: - go test -timeout 1h ./... - detector race test and vet - dispatcher process E2E --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-xray-core#28
No description provided.