|
|
|
@ -53,59 +53,6 @@ If IFB is not available: |
|
|
|
- Upload limiting will be skipped |
|
|
|
- A warning will display in the admin panel |
|
|
|
|
|
|
|
### Docker Container |
|
|
|
The container must run with: |
|
|
|
- `--cap-add=NET_ADMIN` (required for tc commands) |
|
|
|
- `--cap-add=SYS_MODULE` (required for IFB module loading) |
|
|
|
|
|
|
|
Example docker-compose: |
|
|
|
```yaml |
|
|
|
services: |
|
|
|
wg-easy: |
|
|
|
image: ghcr.io/wg-easy/wg-easy |
|
|
|
cap_add: |
|
|
|
- NET_ADMIN |
|
|
|
- SYS_MODULE |
|
|
|
# ... other settings |
|
|
|
``` |
|
|
|
|
|
|
|
## Technical Details |
|
|
|
|
|
|
|
### TC Commands Generated |
|
|
|
|
|
|
|
**Download (egress on wg0):** |
|
|
|
```bash |
|
|
|
tc qdisc add dev wg0 root handle 1: htb default 10 |
|
|
|
tc class add dev wg0 parent 1: classid 1:1 htb rate 100mbit ceil 100mbit |
|
|
|
tc class add dev wg0 parent 1:1 classid 1:10 htb rate 100mbit ceil 100mbit |
|
|
|
``` |
|
|
|
|
|
|
|
**Upload (ingress via IFB mirror):** |
|
|
|
```bash |
|
|
|
ip link add ifb0 type ifb |
|
|
|
ip link set ifb0 up |
|
|
|
tc qdisc add dev wg0 handle ffff: ingress |
|
|
|
tc filter add dev wg0 parent ffff: protocol all u32 match u32 0 0 action mirred egress redirect dev ifb0 |
|
|
|
tc qdisc add dev ifb0 root handle 1: htb default 10 |
|
|
|
tc class add dev ifb0 parent 1: classid 1:1 htb rate 50mbit ceil 50mbit |
|
|
|
tc class add dev ifb0 parent 1:1 classid 1:10 htb rate 50mbit ceil 50mbit |
|
|
|
``` |
|
|
|
|
|
|
|
### Database Schema |
|
|
|
|
|
|
|
Settings stored in `general_table`: |
|
|
|
- `bandwidth_enabled` (boolean) |
|
|
|
- `download_limit_mbps` (integer) |
|
|
|
- `upload_limit_mbps` (integer) |
|
|
|
|
|
|
|
### API Endpoints |
|
|
|
|
|
|
|
| Method | Endpoint | Description | |
|
|
|
|--------|----------|-------------| |
|
|
|
| GET | `/api/admin/general` | Get current settings | |
|
|
|
| POST | `/api/admin/general` | Update settings (triggers restart) | |
|
|
|
| GET | `/api/admin/bandwidth-status` | Check IFB availability | |
|
|
|
|
|
|
|
## Troubleshooting |
|
|
|
|
|
|
|
### Bandwidth limits not applied |
|
|
|
|