Skip to content

Commit

Permalink
Update README & Preview.png
Browse files Browse the repository at this point in the history
  • Loading branch information
Simple-Tracker committed Mar 28, 2024
1 parent 87f7100 commit f362823
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
md5sum: false
sha256sum: false
binary_name: 'qBittorrent-ClientBlocker'
extra_files: 'LICENSE README.md config.json'
extra_files: 'LICENSE README.md README.en.md config.json'
- name: 'Upload GitHub Artifact (Nightly Build)'
uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'release' }}
Expand Down
Binary file modified Preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
175 changes: 175 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
# qBittorrent-ClientBlocker

[中文](README.md) [English](README.en.md)

A client blocker compatible with qBittorrent, which is prohibited to include but not limited to clients such as Xunlei, and support qBittorrent 4.1 and above version.

- Support many platforms
- Support log and hot-reload config
- Support ignore private ip
- Support custom blockList (Case-Inensitive, Support regular expression)
- Support client authentication
- Support enhanced automatic ban (Default disable): Automatically ban peer based on the default or set related parameter
- Under Windows, support show and hide window through the Ctrl+Alt+B window hotkey (Some users [feedback](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/issues/10) it may affect ban. Due to unknown reason, the function can be avoided if related problem are encountered)

![Preview](Preview.png)

## 使用 Usage

### Prerequisite

- qBittorrent Web UI must be enabled.

### Use conventional version

1. Download compressed from [**GitHub Release**](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/releases) and decompress it;

<details>
<summary>View common platform download version of comparison table</summary>

| OS | Processor Arch | Processor Integers | Download Version | Note |
| -------- | ---------- | ---------- | ------------- | ------------------------------------------------------ |
| macOS | ARM64 | 64-bit | darwin-arm64 | Common in Apple M series |
| macOS | AMD64 | 64-bit | darwin-amd64 | Common in Intel series |
| Windows | AMD64 | 64-bit | windows-amd64 | Common in most modern PC |
| Windows | i386 | 32-bit | windows-386 | Occasionally on some old PC |
| Windows | ARM64 | 64-bit | windows-arm64 | Common on new platform, it's applied to some tablet/notebooks/minority special hardware |
| Windows | ARMv6 | 32-bit | windows-arm | Rare platform, applied to some ancient hardware, such as Surface RT, etc |
| Linux | AMD64 | 64-bit | linux-amd64 | Common NAS and server |
| Linux | i386 | 32-bit | linux-386 | Rarely in some old NAS and server |
| Linux | ARM64 | 64-bit | linux-arm64 | Common server and development board, such as Oracle or Raspberry Pi, etc |
| Linux | ARMv6 | 32-bit | linux-arm | Rarely in some old server and development board |

Other versions of Linux/Netbsd/FreeBSD/OpenBSD/Solaris can use this form as an example, and select one that suits you in the list.
</details>

2. After decompression, you may need to modify the attached config file ```config.json```;

- You can set config according to high-level needs. See [配置 Config](#配置-config).
- If blocker runs on this machine, but qBittorrent "Skip client certification" is disabled (and password is not empty and does not manually set password in blocker), you must modify config file and fill in ```qBPassword```.
- If blocker is not running on this machine or qBittorrent is not installed on the default path or using blocker with 2.4 and below version, config file must be modified and fills in ```qBURL```/```qBUsername```/```qBPassword```.

3. Start blocker and observe whether the information output is normal;

For Windows, you can choose shortcut of qBittorrent, put your own blocker path, and run qBittorrent and blocker at the same time;

```
C:\Windows\System32\cmd.exe /c "(tasklist | findstr qBittorrent-ClientBlocker || start C:\Users\Example\qBittorrent-ClientBlocker\qBittorrent-ClientBlocker.exe) && start qbittorrent.exe"
```

For macOS, You can choose a basic [LaunchAgent](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/wiki#launchagent-macos) for starting from OS start and background run;

For Linux, You can choose a basic [Systemd service](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/wiki#systemd-linux) for starting from OS start and background run;

### Use Docker version

- Pull image from [**Docker Hub**](https://hub.docker.com/r/simpletracker/qbittorrent-clientblocker).

```
docker pull simpletracker/qbittorrent-clientblocker:latest
```
- Configuration method 1: Use config file mapping
1. Create a new ```config.json``` in right location, as a configuration file, the specific config can refer [config.json](config.json) and [配置 Config](#配置-config);
2. Fills in ```qBURL```/```qBUsername```/```qBPassword```;
- You can set config according to high-level needs. See [配置 Config](#配置-config).
- If qBittorrent "IP subnet whitelist" is enabled, you don't need fill in ```qBUsername``` and ```qBPassword```.
3. Replace ```/path/config.json``` to your config path;
4. Run docker image and view log to observe whether the information output is normal;
The following command templates are used as a reference only.
```
docker run -d \
--name=qbittorrent-clientblocker --network=bridge --restart unless-stopped \
-v /path/config.json:/app/config.json \
simpletracker/qbittorrent-clientblocker:latest
```
- Configuration method 1: Use environment variable
- Prerequisite: Set the ```useENV``` environment variable is ```true```.
- Use environment variables to configure settings on demand. For details, see [配置 Config](#配置-config).
- If config is complicated, blockList may not take effect. Therefore, if you need to configure this setting, it's not recommended to use environment variable.
- The following command templates are used as a reference only.
```
docker run -d \
--name=qbittorrent-clientblocker --network=bridge --restart unless-stopped \
-e debug=false \
-e logPath=logs \
-e blockList='["ExampleBlockList1", "ExampleBlockList2"]' \
-e qBURL=http://example.com \
-e qBUsername=exampleUser \
-e qBPassword=examplePass \
simpletracker/qbittorrent-clientblocker:latest
```
## 参数 Flag
| Parameter | Default | Note |
| ----- | ----- | ----- |
| -v/--version | false | Show program version and exit |
| -c/--config | config.json | Config path |
| --debug | false | Debug mode. Effective before loading config file |
| --nochdir | false | Don't change working directory. Change to the program directory by default |
## 配置 Config
Docker version is configured through the same name variable configuration, which actually is implemented by automatically conversion environment variable as config file.
Translation not completed yet...
| Parameter | Default | Note |
| ----- | ----- | ----- |
| debug | false | Debug mode. Enable you can see more information, but it may disrupt the field of vision |
| debug_CheckTorrent | false | Debug mode (CheckTorrent, must enable debug). If it's enabled, debug info will include each Torrent Hash, but the amount of information will be large |
| debug_CheckPeer | false | Debug mode (CheckPeer, must enable debug). If it's enabled, debug info will include each Torrent Peer, but the amount of information will be large |
| interval | 6 (秒) | Ban Check Interval. Each cycle interval will obtain relevant information from qBittorrent API for judgment and blocking. Short interval can help reduce ban time but may cause qBittorrent to freeze, but Long interval can help reduce CPU usage |
| cleanInterval | 3600 (Sec) | Clean blocked peer interval. Short interval will cause expired Peer to be unblocked faster after blocking duration is reached, but Long interval will help merge and clean up expired Peer log |
| torrentMapCleanInterval | 60 (Sec) | Torrent Map Clean Interval (Only useful after enable ipUploadedCheck+ipUpCheckPerTorrentRatio/banByRelativeProgressUploaded, It's also the judgment interval). Short interval can make judgments more frequent but may cause delayed misjudgments |
| banTime | 86400 (Sec) | Ban duration. Short interval will cause peer to be unblocked faster |
| banAllPort | false | Block IP all port. Setting is currently not supported |
| ignoreEmptyPeer | true | Ignore peers without PeerID and UserAgent. Usually occurs on clients where connection is not fully established |
| ignorePTTorrent | true | Ignore PT Torrent. If the main Tracker contains ```?passkey=```/```?authkey=```/```?secure=```/```A string of 32 digits consisting of uppercase and lowercase char or/and number``` |
| startDelay | 0 (Sec, Disable) | Start delay. Special uses for some user |
| sleepTime | 20 (MicroSec) | Query waiting time of each Torrent Peers. Short interval can make blocking Peer faster but may cause qBittorrent lag, Long interval can help average CPU usage |
| timeout | 6 (MillSec) | Request timeout. If interval is too short, peer may not be properly blocked. If interval is too long, timeout request will affect blocking other peer |
| longConnection | true | Long connection. Enable to reduce resource consumption |
| logToFile | true | Log general information to file. If enabled, it can be used for general analysis and statistical purposes |
| logDebug | false | Log debug information to file (Must enable debug and logToFile). If enabled, it can be used for advanced analysis and statistical purposes, but the amount of information is large |
| qBURL | Empty | qBittorrent Web UI Address. Prerequisite for using blocker, if qBittorrent config file cannot be automatically read, must be filled in correctly. Prefix must specify http or https protocol, such as ```http://127.0.0.1:990``` |
| qBUsername | Empty | qBittorrent Web UI Username. Leaving it blank will skip authentication. If you enable qBittorrent "Skip local client authentication", you can leave it blank by default, because the qBittorrent config file can be automatically read and set |
| qBPassword | Empty | qBittorrent Web UI Password. If qBittorrent "Skip local client authentication" is enabled, it can be left blank by default |
| useBasicAuth | false | At the same time, authentication is performed through HTTP Basic Auth. It can be used to add/replace authentication method of qBittorrent Web UI through reverse proxy, etc |
| skipCertVerification | false | Skip qBittorrent Web UI certificate verification. Suitable for self-signed and expired certificates |
| blockList | Empty (Included in config.json) | Block client list. Judge PeerID or UserAgent at the same time, case-insensitive, support regular expression |
| ipBlockList | Empty | Block IP list. Support excluding ports IP (1.2.3.4) or IPCIDR (2.3.3.3/3) |
| ipFilterURL | Empty | Block IP list URL. Updated every 24 hours, support format is same as ipBlockList, one rule per line |
| ipUploadedCheck | false | IP 上传增量检测. 在满足下列 IP 上传增量 条件后, 会自动屏蔽 Peer |
| ipUpCheckInterval | 300 (Sec) | IP 上传增量检测/检测间隔. 用于确定上一周期及当前周期, 以比对客户端对 IP 上传增量. 也顺便用于 maxIPPortCount |
| ipUpCheckIncrementMB | 38000 (MB) | IP 上传增量检测/增量大小. 若 IP 全局上传增量大小大于设置增量大小, 则允许屏蔽 Peer |
| ipUpCheckPerTorrentRatio | 3 (X) | IP 上传增量检测/增量倍率. 若 IP 单个 Torrent 上传增量大小大于设置增量倍率及 Torrent 大小之乘积, 则允许屏蔽 Peer |
| maxIPPortCount | 0 (Disable) | 每 IP 最大端口数. 若 IP 端口数大于设置值, 会自动屏蔽 Peer |
| banByProgressUploaded | false | 增强自动屏蔽 (根据进度及上传量屏蔽 Peer, 未经测试验证). 在满足下列 增强自动屏蔽 条件后, 会自动屏蔽 Peer |
| banByPUStartMB | 10 (MB) | 增强自动屏蔽/起始大小. 若客户端上传量大于起始大小, 则允许屏蔽 Peer |
| banByPUStartPrecent | 2 (%) | 增强自动屏蔽/起始进度. 若客户端上传进度大于设置起始进度, 则允许屏蔽 Peer |
| banByPUAntiErrorRatio | 5 (X) | 增强自动屏蔽/滞后防误判倍率. 若 Peer 报告下载进度与设置倍率及 Torrent 大小之乘积得到之下载量 比 客户端上传量 还低, 则允许屏蔽 Peer |
| banByRelativeProgressUploaded | false | 增强自动屏蔽_相对 (根据相对进度及相对上传量屏蔽 Peer, 未经测试验证). 在满足下列 增强自动屏蔽_相对 条件后, 会自动屏蔽 Peer. 此功能当前故障 |
| banByRelativePUStartMB | 10 (MB) | 增强自动屏蔽_相对/起始大小. 若客户端相对上传量大于设置起始大小, 则允许屏蔽 Peer |
| banByRelativePUStartPrecent | 2 (%) | 增强自动屏蔽_相对/起始进度. 若客户端相对上传进度大于设置起始进度, 则允许屏蔽 Peer |
| banByRelativePUAntiErrorRatio | 5 (X) | 增强自动屏蔽_相对/滞后防误判倍率. 若 Peer 报告相对下载进度与设置倍率之乘积得到之相对下载进度 比 客户端相对上传进度 还低, 则允许屏蔽 Peer |
## 反馈 Feedback
User and developer can report bug through [Issue](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/issues), through [Discussion](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/discussions) ask/discuss/share usage, through [Pull Request](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/pulls) contribute code improvement to blocker.
Note: When opening a Pull Request for a Feature, please do not create an Issue simultaneously.
## 致谢 Credit
1. We partially referenced [jinliming2/qbittorrent-ban-xunlei](https://github.com/jinliming2/qbittorrent-ban-xunlei) during early development of blocker;
2. We will thank the user and developer who contributed code improvement to blocker through Pull Request in Release Note;
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# qBittorrent-ClientBlocker

[中文](README.md) [English](README.en.md)

一款适用于 qBittorrent 的客户端屏蔽器, 默认屏蔽包括但不限于迅雷等客户端, 支持 qBittorrent 4.1 及以上版本.

- 全平台支持
Expand Down Expand Up @@ -43,9 +45,9 @@

2. 解压后, 可能需要修改随附的配置文件 ```config.json```;

- 可根据高级需求, 按需设置配置, 具体见 [配置 Config](#配置-config)
- 若客户端屏蔽器运行于本机, 但未启用 qBittorrent "跳过本机客户端认证" (及密码不为空且并未手动设置密码), 则必须修改配置文件, 并填写 `qBPassword`.
- 若客户端屏蔽器不运行于本机 或 qBittorrent 未安装在默认路径 或 使用 2.4 及以下版本的客户端屏蔽器, 则必须修改配置文件, 并填写 `qBURL`/`qBUsername`/`qBPassword`.
- 可根据高级需求, 按需设置配置, 具体见 [配置 Config](#配置-config).
- 若客户端屏蔽器运行于本机, 但未启用 qBittorrent "跳过本机客户端认证" (及密码不为空且并未手动设置密码), 则必须修改配置文件, 并填写 ```qBPassword```.
- 若客户端屏蔽器不运行于本机 或 qBittorrent 未安装在默认路径 或 使用 2.4 及以下版本的客户端屏蔽器, 则必须修改配置文件, 并填写 ```qBURL```/```qBUsername```/```qBPassword```.

3. 启动客户端屏蔽器, 并观察信息输出是否正常即可;

Expand All @@ -69,14 +71,14 @@
- 配置方法一: 使用 配置文件映射
1. 在合适位置新建 `config.json` 作为配置文件, 具体内容可参考 [config.json](config.json) 及 [配置 Config](#配置-config);
1. 在合适位置新建 ```config.json``` 作为配置文件, 具体内容可参考 [config.json](config.json) 及 [配置 Config](#配置-config);
2. 填入 `qBURL`/`qBUsername`/`qBPassword`;
2. 填入 ```qBURL```/```qBUsername```/```qBPassword```;
- 可根据高级需求, 按需设置其它配置, 具体见 [配置 Config](#配置-config).
- 若启用 qBittorrent 的 "IP 子网白名单", 则可不填写 `qBUsername` 和 `qBPassword`.
- 若启用 qBittorrent 的 "IP 子网白名单", 则可不填写 ```qBUsername``` 和 ```qBPassword```.
3. 替换 `/path/config.json` 为你的配置文件路径;
3. 替换 ```/path/config.json``` 为你的配置文件路径;
4. 运行 Docker 并查看日志, 观察信息输出是否正常即可;
Expand Down Expand Up @@ -146,7 +148,7 @@ Docker 版本通过相同名称的环境变量配置, 通过自动转换环境
| skipCertVerification | false (禁用) | 跳过 qBittorrent Web UI 证书校验. 适合自签及过期证书 |
| blockList | 空 (于 config.json 附带) | 屏蔽客户端列表. 同时判断 PeerID 及 UserAgent, 不区分大小写, 支持正则表达式 |
| ipBlockList | 空 | 屏蔽 IP 列表. 支持不包括端口的 IP (1.2.3.4) 及 IPCIDR (2.3.3.3/3) |
| ipFilterURL | 空 | 屏蔽 IP 列表 URL. 支持格式同 ipBlockList, 一行一条 |
| ipFilterURL | 空 | 屏蔽 IP 列表 URL. 每 24 小时更新, 支持格式同 ipBlockList, 一行一条 |
| ipUploadedCheck | false (禁用) | IP 上传增量检测. 在满足下列 IP 上传增量 条件后, 会自动屏蔽 Peer |
| ipUpCheckInterval | 300 (秒) | IP 上传增量检测/检测间隔. 用于确定上一周期及当前周期, 以比对客户端对 IP 上传增量. 也顺便用于 maxIPPortCount |
| ipUpCheckIncrementMB | 38000 (MB) | IP 上传增量检测/增量大小. 若 IP 全局上传增量大小大于设置增量大小, 则允许屏蔽 Peer |
Expand All @@ -162,7 +164,7 @@ Docker 版本通过相同名称的环境变量配置, 通过自动转换环境
| banByRelativePUAntiErrorRatio | 5 (X) | 增强自动屏蔽_相对/滞后防误判倍率. 若 Peer 报告相对下载进度与设置倍率之乘积得到之相对下载进度 比 客户端相对上传进度 还低, 则允许屏蔽 Peer |
## 反馈 Feedback
用户及开发者可以通过 [Issue](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/issues) 反馈 bug, 通过 [Discussion](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/discussions) 讨论/提问/分享 使用方法, 通过 [Pull Request](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/pulls) 向客户端屏蔽器贡献代码改进.
用户及开发者可以通过 [Issue](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/issues) 反馈 bug, 通过 [Discussion](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/discussions) 提问/讨论/分享 使用方法, 通过 [Pull Request](https://github.com/Simple-Tracker/qBittorrent-ClientBlocker/pulls) 向客户端屏蔽器贡献代码改进.
注意: 为 Feature 发起 Pull Request 时, 请不要同步创建 Issue.
## 致谢 Credit
Expand Down

0 comments on commit f362823

Please sign in to comment.