Simple-Tracker / qBittorrent-ClientBlocker

一款适用于 qBittorrent/Transmission (Beta)/BitComet (Beta, Partial) 的客户端屏蔽器, 默认屏蔽包括但不限于迅雷等客户端. A client blocker compatible with qBittorrent/Transmission (Beta)/BitComet (Beta, Partial) which is prohibited to include but not limited to clients such as Xunlei.
MIT License
934 stars 24 forks source link

2.6b4 无法连接 localhost #11

Closed mzhboy closed 7 months ago

mzhboy commented 7 months ago

system: ubuntu 22.04 on pi4, 64bit qee 4.6.3.10

日志

[2024-02-04 21:51:35][LoadConfig-Current] QBURL: http://localhost:8080. [2024-02-04 21:51:35][LoadConfig-Current] QBUsername: . [2024-02-04 21:51:35][LoadConfig-Current] QBPassword: . [2024-02-04 21:51:35][LoadConfig-Current] 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 da. [2024-02-04 21:51:35][Debug-LoadConfig-CompileBlockList] -(XL|SD|XF|QD|BN|DL)(\d+)-. [2024-02-04 21:51:35][Debug-LoadConfig-CompileBlockList] ((^(xunlei?).?\d+.\d+.\d+.\d+)|cacao_torrent). [2024-02-04 21:51:35][Debug-LoadConfig-CompileBlockList] -(UW\w{4}|SP(([0-2]\d{3})|(3[0-5]\d{2})))-. [2024-02-04 21:51:35][Debug-LoadConfig-CompileBlockList] StellarPlayer. [2024-02-04 21:51:35][Debug-LoadConfig-CompileBlockList] dandanplay. [2024-02-04 21:51:35][Debug-LoadConfig-CompileBlockList] anacrolix[ /]torrent v?([0-1].(([0-9]|[0-4][0-9]|[0-5][0-2]).[0-9]+|(53.0-2))|unknown). [2024-02-04 21:51:51][Submit] 请求时发生了错误: Post "http://localhost:8080/api/v2/app/setPreferences": context deadline exceeded (Client.Timeout exceeded while awaiting headers). [2024-02-04 21:51:51][SubmitBlockPeer] 发生错误. [2024-02-04 21:51:51][RunConsole] 程序已启动. [2024-02-04 21:52:12][Fetch] 请求时发生了错误: Get "http://localhost:8080/api/v2/sync/maindata?rid=0": context deadline exceeded (Client.Timeout exceeded while awaiting headers). [2024-02-04 21:52:12][FetchMaindata] 发生错误.

windows 上OK

不甘心于是测试 2.5P4,也是不行;qee开启了localhost无需验证webui。

变通的办法,这是意外发现的,填写在内网的IP是可以的。

netstat -nlp|grep 8080 tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 625/qbittorrent-nox

mzhboy commented 7 months ago

还有应该加个 -v 选项标识版本

Simple-Tracker commented 7 months ago

感谢反馈及建议!

  1. 客户端只将设定 QBURL 组合成完整 API 地址并发出请求, 其具体逻辑是由 Go 语言自带 http 包及操作系统等共同决定的, 若有不正常的现象建议使用 IP 替代 (可能出现在 localhost 未解析或是操作系统支持性不好或是路径较为奇怪的场合);
  2. 关于版本问题, 未来将会寻找实现方式并考虑优化;

以下是在 AlmaLinux release 8.6 (Sky Tiger) 内核 4.18.0, qBittorrent 4.4.3.1 下进行的测试, 结果显示 localhost 下一切正常:

[root@STG qBittorrent-ClientBlocker]#  /usr/local/bin/qBittorrent-ClientBlocker 
[2024-02-04 22:31:23][LoadConfig] 读取配置文件成功.
[2024-02-04 22:31:23][LoadConfig-Current] Debug: true.
[2024-02-04 22:31:23][LoadConfig-Current] QBURL: http://localhost:990.
[2024-02-04 22:31:23][LoadConfig-Current] QBUsername: .
[2024-02-04 22:31:23][LoadConfig-Current] QBPassword: .
[2024-02-04 22:31:23][RunConsole] 程序已启动.
[2024-02-04 22:31:25][Debug-FetchMaindata] 完整更新: true.
[2024-02-04 22:31:25][Debug-CheckTorrent] 450d4fba97fa65dd0b0cbef9f589fcf81e123391.
[2024-02-04 22:31:25][Debug-CheckTorrent] 759a4a1c5d005d6f6e661451a1269e43db50e8d3.
[2024-02-04 22:31:25][Debug-CheckTorrent] 0c2ff20b0638f2a605a075c16c5a03d99006b769.
[2024-02-04 22:31:25][Debug-CheckTorrent] 0cc7f68a0937e37677b50a344913c510cc7703d1.
mzhboy commented 7 months ago

测试了 localhost 改为 127.0.0.1 也是同样的

+--------------

看起来原因不好调查,暂且用内网ip的方式使用

mzhboy commented 7 months ago

突然想起我设置了iptables来过滤敏感端口的访问,调查一下果然发现没有开放本地对敏感端口的访问。 所以这是我的锅,问题解决。 也提醒其他人勿犯同样的错误。

Simple-Tracker commented 7 months ago

解决就好, 刚看到已经解决了, 我还特意在我的唯一一台 ARM Linux 设备上做了测试.


root@STG:~/1# cat debian_version 
9.11
root@STG:~/1# uname -a
Linux STG 4.19.62-sunxi #5.92 SMP Wed Jul 31 22:07:23 CEST 2019 armv7l GNU/Linux
root@STG:~/1# tar xzf qBittorrent-ClientBlocker-2.5p4-linux-arm.tar.gz 
root@STG:~/1# wget 'https://github.com/userdocs/qbittorrent-nox-static/releases/download/release-4.6.3_v2.0.9/armv7-qbittorrent-nox'
2024-02-04 22:56:22 (3.33 MB/s) - 已保存 “armv7-qbittorrent-nox” [20274372/20274372])
root@STG:~/1# screen qbittorrent-nox
******** 信息 ********
要控制 qBittorrent,请访问下列地址的 WebUI:http://localhost:8080
WebUI 管理员用户名是:admin
未设置 WebUI 管理员密码。为此会话提供了一个临时密码:zm6ntjT3x
[detached from 24739.pts-1.STG]
root@STG:~/1# vi config.json
root@STG:~/1# ./qBittorrent-ClientBlocker 
[2024-02-04 22:57:54][LoadConfig] 读取配置文件成功.
[2024-02-04 22:57:54][LoadConfig-Current] Debug: true.
[2024-02-04 22:57:54][LoadConfig-Current] LongConnection: true.
[2024-02-04 22:57:54][LoadConfig-Current] QBURL: http://localhost:8080.
[2024-02-04 22:57:54][LoadConfig-Current] QBUsername: admin.
[2024-02-04 22:57:54][LoadConfig-Current] QBPassword: zm6ntjT3x.
[2024-02-04 22:57:56][Login] 登录成功.
[2024-02-04 22:57:56][Login] 登录成功.
[2024-02-04 22:57:56][RunConsole] 程序已启动.
[2024-02-04 22:57:58][Debug-FetchMaindata] 完整更新: true.
[2024-02-04 22:57:58][Debug-Task_IgnoreEmptyHashCount] 0.
[2024-02-04 22:57:58][Debug-Task_IgnoreNoLeechersCount] 0.
[2024-02-04 22:57:58][Debug-Task_IgnoreBadTorrentInfoCount] 0.
[2024-02-04 22:57:58][Debug-Task_IgnoreBadPeersCount] 0.
^C
Simple-Tracker commented 7 months ago

已在 2.6b7 及后续版本显示版本号 (程序启动时), 也可通过 -v/-version/--version 等手动查看.