Skip to content

Extend BitTorrent sniffer - #6668

Closed
MakostaDev wants to merge 1 commit into
XTLS:mainfrom
MakostaDev:bittorrent
Closed

Extend BitTorrent sniffer#6668
MakostaDev wants to merge 1 commit into
XTLS:mainfrom
MakostaDev:bittorrent

Conversation

@MakostaDev

Copy link
Copy Markdown
Contributor

Currently, the BitTorrent sniffer can only detect the BitTorrent Handshake and uTP (uTP is currently broken, but PR #6667 fixes it).

I decided to add detection for several protocols from the BitTorrent family:

Also string(b[1:20]) in SniffBittorrent() causes an allocation. It was replaced with bytes.HasPrefix.

I tested this using Wireshark and BitComet/qBittorrent

@MakostaDev MakostaDev changed the title Extend bittorrent sniffer Extend BitTorrent sniffer Aug 23, 2026
@Fangliding

Fangliding commented Aug 23, 2026

Copy link
Copy Markdown
Member

torrent sniffer 出于兼容性而保留 实际意义不大 它可以被非常轻松的绕过 所以不打算扩展
个人认为管理torrent的合理方法是封锁tracker ip和限制高位udp端口

@Fangliding Fangliding closed this Aug 23, 2026
@MakostaDev

MakostaDev commented Aug 23, 2026

Copy link
Copy Markdown
Contributor Author

torrent sniffer 出于兼容性而保留 实际意义不大

@Fangliding with the help of a webhook, rules can warn/punish users who use torrents (this approach is used in the Torrent Blocker of the Remnawave Panel). And I know that it's impossible to completely block torrents.

When I checked packets from BitComet, I didn't notice a single uTP packet or BitTorrent Handshake (with default settings).

This PR just extends detection. And it contains very little code

@Chara-Freedom

Copy link
Copy Markdown

@RPRX why

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.

3 participants