feat: per-peer speed limit (Mbps, step 0.1, 0 = unlimited) for AmneziaWG - #106
Open
leonidorlov-hash wants to merge 2 commits into
Open
feat: per-peer speed limit (Mbps, step 0.1, 0 = unlimited) for AmneziaWG#106leonidorlov-hash wants to merge 2 commits into
leonidorlov-hash wants to merge 2 commits into
Conversation
- awg_manager: set_speed_limit() applies tc HTB (egress) + ingress policer inside container for peer IPv4/IPv6; limits persisted to bwlimits file and re-applied on container start - maxSpeed stored in clientsTable userData - UI: speed badge on peer card, speed field with label in rename dialog - translations: en/ru/fr/fa/zh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что добавляет PR
Возможность задать каждому пиру AmneziaWG индивидуальный лимит скорости в Мбит/с (шаг 0.1,
0= без лимита).Как работает
managers/awg_manager.py— новый методset_speed_limit():tc qdisc htbна интерфейсеawg0, класс сrate/ceilдля IPv4 и IPv6 адреса пираtc qdisc ingress+ policer на пир-IPbwlimitsрядом сclientsTableи автоматически применяются при старте контейнера (хук вstart.sh)_save_clients_table— лимиты переживают добавление/удаление пиров и пересоздание интерфейсаuserData.maxSpeedвclientsTable, как и остальные пользовательские поля пираapp.py—RenameConnectionRequest.max_speed(float,-1= не менять);api_rename_connectionприменяет лимит черезset_speed_limit, ошибки tc возвращаются какspeed_warningв ответе (rename при этом не падает)templates/server.html):⚡∞ / ⚡X Mbpsна карточке пира (только для AWG-протоколов)step=0.1Совместимость
tcприсутствует в образеamneziavpn/amneziawg-go(проверено)set_speed_limit(кастомные сборки), панель молча пропускает (hasattr-проверка)Тест
Проверено на живом сервере (панель на одном хосте, инстанс AWG 2.0 на другом): установлен лимит 1 Мбит/с через UI → реальная скорость пира резалась до ~1 Мбит/с. Снятие лимита (0) восстанавливает полную скорость.