Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

建议可以保留原本的ip屏蔽设置 #10

Closed
RX-105 opened this issue Feb 2, 2024 · 12 comments
Closed

建议可以保留原本的ip屏蔽设置 #10

RX-105 opened this issue Feb 2, 2024 · 12 comments
Labels
enhancement New feature or request wontfix This will not be worked on

Comments

@RX-105
Copy link

RX-105 commented Feb 2, 2024

在启动了程序之后,我注意到qb原有的ip屏蔽设置(IP Filtering > Manually banned IP addresses)会被清除,然后再基于本次屏蔽的peer重新写入新的屏蔽列表。以前屏蔽过的peer本次可能再次出现,再加上程序有时不能正常扫描所有的peer,就导致再次被吸血😂

image

如图,启动了没多久就被吸了12GiB,还是anacrolix。这期间程序似乎没有正常工作,我也没看出来原因。

如果可以的话,我希望可以程序启动后不要清除原有的屏蔽设置,而是在现有的基础上附加。谢谢。

@Simple-Tracker
Copy link
Owner

Simple-Tracker commented Feb 2, 2024

感谢反馈!

  1. 清除原有屏蔽设置是为防止 IP 残留, 程序只能维护自己的屏蔽列表, 只在程序启动时清理一次, 其后每一次均是追加程序维护的屏蔽列表. 目前没有计划解析用户手动设置的屏蔽列表, 若用户需要手动屏蔽 IP, 可尝试配合 filter.dat 使用;
  2. 未屏蔽问题, 此前的 2.5 可能有 bug, 若未更新, 请更新至 2.5p2 及以上, 同时更新 config.json 后再试. 若还有问题, 可附上 Torrent Magnet 用于测试;

(正常情况下, 不能扫描所有 Peer 的问题, 只会在 qB 响应缓慢的情况发生. 通过打开 Debug 开关, 可以看到程序实时进度, 获得更多信息.)

@zhongfly
Copy link

zhongfly commented Feb 3, 2024

启动了没多久就被吸了12GiB,还是anacrolix。这期间程序似乎没有正常工作

应该是程序在启动后不会立即开始屏蔽,而是会等待一个interval的时间再开始执行屏蔽

for range time.Tick(time.Duration(config.Interval) * time.Second) {

@RX-105
Copy link
Author

RX-105 commented Feb 3, 2024

  1. 清除原有屏蔽设置是为防止 IP 残留, 程序只能维护自己的屏蔽列表, 只在程序启动时清理一次, 其后每一次均是追加程序维护的屏蔽列表. 目前没有计划解析用户手动设置的屏蔽列表, 若用户需要手动屏蔽 IP, 可尝试配合 filter.dat 使用;

其实我觉得问题可能就是这个。昨天程序屏蔽了4个peer,今天开机后程序随windows自启动,昨天的4个屏蔽的peer就被清除了,然后今天上午屏蔽了2个peer。刚刚我pull了master,重新build了程序并替换,之前那2个peer也没了,然后重新开始的。我觉得应该不清除现有的屏蔽列表,只是添加新的peer ip。

image

另外发现的一个问题是我替换主程序的时候发现的。程序正在最小化运行(用快捷键),但是有两个peer正在吸血,没有被处理。我退出最小化后,这两个peer就被处理了。我想会不会是最小化的行为影响了程序的正常运行。

抱歉可能我能帮到的也就这些了 我并不会写go😥

@Simple-Tracker
Copy link
Owner

由于程序屏蔽很快, 因此这并不是一个非常大的问题, 而且维护已添加的屏蔽列表需要额外的工作且收益很小.
但后者的问题似乎确实存在, 这应该是导致无法屏蔽的核心原因, 在此期间建议避免使用热键功能, 我们正在寻找可行的解决/替代方案, 若实在无法解决只好取消此功能.

@zhongfly
Copy link

zhongfly commented Feb 3, 2024

最小化我建议用小工具 RBTray,右键窗口的最小化按钮就能到托盘,比快捷键方便多了
https://github.com/benbuck/rbtray

@Simple-Tracker
Copy link
Owner

Simple-Tracker commented Feb 3, 2024

我已再次测试, 此问题无法复现.
于 Windows Server 2022 21H2 使用 Release 最新的 2.5p4 进行测试, 具体步骤:

  1. 开启 Debug 模式, 启动程序, 使用快捷键 CTRL+ALT+B 隐藏窗口;
  2. 等待一段时间, 观察日志确实输出于文件;
  3. 修改 config.json 中的屏蔽列表, 观察日志, 发现热重载顺利完成, 客户端也顺利屏蔽;
  4. 关闭 Debug 模式, 关闭并再次启动程序, 使用快捷键 CTRL+ALT+B 隐藏窗口;
  5. 修改 config.json 中的屏蔽列表, 观察日志, 发现热重载顺利完成, 客户端也顺利屏蔽;

若确实遇到此问题, 可能与操作系统节能策略等有关 (如: 当程序不在前台活跃时暂停程序), 可考虑尝试第三方小工具如楼上提到的 RbTray 等隐藏窗口.
若前台后仍观察到此现象, 请启用 Debug 模式并观察是否在连续输出或出现超时 Timeout 错误, 这有概率可能意味着你的 qBittorrent 本身响应缓慢.

这一功能的失效是因为控制台窗口隐藏, 而非热键隐藏的原因. 晚些时候, 可能计划放弃热键隐藏功能, 而转为使用拖盘按钮.

@Simple-Tracker
Copy link
Owner

另外, 对于桌面使用, 也可尝试 qBEE (若无 PT 需求) 或本地部署+自启动 Docker 版本.

qBEE: https://github.com/c0re100/qBittorrent-Enhanced-Edition/releases
peer_blacklist.txt (qBEE): anacrolix/torrent#891 (reply in thread)

@RX-105
Copy link
Author

RX-105 commented Feb 3, 2024

其实我用的就是qbee,不过不知道是不是我配置的问题(只改了Upload choking algorithm选Anti-leech),某些使用anacrolix的吸血peer没有被处理。

窗口隐藏的问题之后我再仔细观察一下吧。

@RX-105
Copy link
Author

RX-105 commented Feb 3, 2024

复现出来了,时间是00:21:14。
系统是Windows 10,qbee 4.6.3.10,程序是我自己build的,hash为38354520。除了在console.go里多了个日志打印,没有做其他的代码修改。
使用快捷键隐藏,关闭外部的过滤文件。
2024-02-04_002114
下面是部分日志,我移除了部分其他client的输出:

[2024-02-04 00:21:14][Debug-CheckPeer_IgnorePeer (Blocked)] 59.47.225.xx:23492 github.com/anacrolix/torrent (devel) (anacrolix/torrent unknown).
[2024-02-04 00:21:18][Debug-Task_IgnoreEmptyHashCount] 0.
[2024-02-04 00:21:18][Debug-Task_IgnoreNoLeechersCount] 186.
[2024-02-04 00:21:18][Debug-Task_IgnoreBadTorrentInfoCount] 0.
[2024-02-04 00:21:18][Debug-Task_IgnoreBadPeersCount] 60.
[2024-02-04 00:21:18][Debug-FetchMaindata] 完整更新: true.
[2024-02-04 00:21:21][Debug-CheckPeer] 134.19.179.xx Transmission 2.9.4.
[2024-02-04 00:21:22][Debug-CheckPeer_IgnorePeer (Blocked)] 59.47.225.xx:23492 github.com/anacrolix/torrent (devel) (anacrolix/torrent unknown).
[2024-02-04 00:21:24][Debug-CheckPeer] 182.55.131.xx BitComet 1.67.
[2024-02-04 00:21:25][Debug-Task_IgnoreEmptyHashCount] 0.
[2024-02-04 00:21:25][Debug-Task_IgnoreNoLeechersCount] 187.
[2024-02-04 00:21:25][Debug-Task_IgnoreBadTorrentInfoCount] 0.
[2024-02-04 00:21:25][Debug-Task_IgnoreBadPeersCount] 56.
[2024-02-04 00:21:25][Debug-FetchMaindata] 完整更新: true.
[2024-02-04 00:21:27][Debug-CheckPeer_IgnorePeer (Blocked)] 59.47.225.xx:23492 github.com/anacrolix/torrent (devel) (anacrolix/torrent unknown).
[2024-02-04 00:21:31][Debug-Task_IgnoreEmptyHashCount] 0.
[2024-02-04 00:21:31][Debug-Task_IgnoreNoLeechersCount] 185.
[2024-02-04 00:21:31][Debug-Task_IgnoreBadTorrentInfoCount] 0.
[2024-02-04 00:21:31][Debug-Task_IgnoreBadPeersCount] 69.
[2024-02-04 00:21:31][Debug-FetchMaindata] 完整更新: true.
[2024-02-04 00:21:37][Debug-CheckPeer_IgnorePeer (Blocked)] 59.47.225.xx:23492 github.com/anacrolix/torrent (devel) (anacrolix/torrent unknown).
[2024-02-04 00:21:38][Debug-Task_IgnoreEmptyHashCount] 0.
[2024-02-04 00:21:38][Debug-Task_IgnoreNoLeechersCount] 182.
[2024-02-04 00:21:38][Debug-Task_IgnoreBadTorrentInfoCount] 0.
[2024-02-04 00:21:38][Debug-Task_IgnoreBadPeersCount] 98.
[2024-02-04 00:21:38][Debug-FetchMaindata] 完整更新: true.
[2024-02-04 00:21:44][Debug-RegHotKey] 开始监听窗口热键.
[2024-02-04 00:21:44][Debug-ShowOrHiddenWindow] 窗口显示.
[2024-02-04 00:21:44][Debug-CheckPeer_IgnorePeer (Blocked)] 59.47.225.xx:23492 github.com/anacrolix/torrent (devel) (anacrolix/torrent unknown).
[2024-02-04 00:21:44][Debug-CheckPeer] 210.22.74.xx qBittorrent 4.5.3.
[2024-02-04 00:21:45][Debug-Task_IgnoreEmptyHashCount] 0.
[2024-02-04 00:21:45][Debug-Task_IgnoreNoLeechersCount] 182.
[2024-02-04 00:21:45][Debug-Task_IgnoreBadTorrentInfoCount] 0.
[2024-02-04 00:21:45][Debug-Task_IgnoreBadPeersCount] 110.
[2024-02-04 00:21:45][Debug-FetchMaindata] 完整更新: true.

config.json

{
	"debug": true,
	"interval": 2,
	"cleanInterval": 3600,
	"banTime": 86400,
	"sleepTime": 20,
	"timeout": 6,
	"longConnection": true,
	"logToFile": true,
	"logDebug": false,
	"qBURL": "http://127.0.0.1:8098",
	"qBUsername": "",
	"qBPassword": "",
	"blockList": ["-(XL|SD|XF|QD|BN|DL)(\\d+)-", "((^(xunlei?).?\\d+.\\d+.\\d+.\\d+)|cacao_torrent)", "-(UW\\w{4}|SP(([0-2]\\d{3})|(3[0-5]\\d{2})))-", "StellarPlayer", "dandanplay", "anacrolix/torrent v?([0-1]\\.([0-9]|[0-3][0-9])\\.[0-9]?[0-9]?|unknown)"]
}

@Simple-Tracker
Copy link
Owner

Simple-Tracker commented Feb 3, 2024

日志上能看到的只有其正在正常检测 Peer, 因为 NoLeecher 仍有数值, 且能检测到屏蔽过的 Peer.
(另: 若在程序运行时删除屏蔽列表, 则除非发生了清理或屏蔽, 否则不会更新屏蔽列表以节省资源, 所以中途删除用于测试是不合适的)
但不知为何你的 qBittorrent 返回了过多的 BadPeers, 可能是由于新连接太多 (qBittorrent 对于仍未连接完全的客户端不会提供 Client), 程序会忽略此次检查.
已发布 2.6 版本, 支持设置 debug_CheckPeer 选项, 以显示具体 Peer 的检查输出.

对于 CheckTorrent Status: 0/正常状态, -1/空 Hash (IgnoreEmptyHashCount), -2/无下载者 (IgnoreNoLeechersCount), -3/无法抓取 Peer (IgnoreBadTorrentInfoCount).
对于 CheckPeer Status: 0/正常状态, -1/Peer 的 IP 为空 或 客户端 为空 或 IP 为私有 IP 段, 1/新增绝对进度屏蔽, 2/已被普通屏蔽, 3/已被特殊屏蔽-IP 太多端口或上传过高, 4/已被特殊屏蔽-相对上传进度有问题 (未来将会转为普通屏蔽).

IgnoreEmptyHashCount: 空 Hash
IgnoreNoLeechersCount: 无下载者
IgnoreBadTorrentInfoCount: 坏的 Torrent 信息 (一般由无法抓取引起)
IgnoreBadPeersCount: eer 的 IP 为空 或 客户端 为空 或 IP 为私有 IP 段

这是我在测试时的日志:

[2024-02-03 17:19:00][Debug-Task_IgnoreEmptyHashCount] 0.
[2024-02-03 17:19:00][Debug-Task_IgnoreNoLeechersCount] 487.
[2024-02-03 17:19:00][Debug-Task_IgnoreBadTorrentInfoCount] 0.
[2024-02-03 17:19:00][Debug-Task_IgnoreBadPeersCount] 13.

@Simple-Tracker Simple-Tracker added the enhancement New feature or request label Feb 4, 2024
@RX-105
Copy link
Author

RX-105 commented Feb 5, 2024

我现在用了另一个方法 把窗口放到第二桌面上 既保证了窗口显示 又不会占用桌面空间
现在算是解决了( ゚∀。)

@Simple-Tracker Simple-Tracker added the wontfix This will not be worked on label Feb 5, 2024
@Simple-Tracker
Copy link
Owner

解决就好! 若有其它问题欢迎再次报告.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants