nuno ревизий этого фрагмента 1 month ago. К ревизии
1 file changed, 22 insertions
gistfile1.txt(файл создан)
| @@ -0,0 +1,22 @@ | |||
| 1 | + | grep -A 20 "function cmd::group::watch" /etc/wireguard/wgctl/commands/group.command.sh | |
| 2 | + | function cmd::group::watch() { | |
| 3 | + | local name="" | |
| 4 | + | ||
| 5 | + | while [[ $# -gt 0 ]]; do | |
| 6 | + | case "$1" in | |
| 7 | + | --name) util::require_flag "--name" "${2:-}" || return 1; name="$2"; shift 2 ;; | |
| 8 | + | --help) cmd::group::help; return ;; | |
| 9 | + | *) log::error "Unknown flag: $1"; return 1 ;; | |
| 10 | + | esac | |
| 11 | + | done | |
| 12 | + | ||
| 13 | + | [[ -z "$name" ]] && log::error "Missing required flag: --name" && return 1 | |
| 14 | + | group::require_exists "$name" || return 1 | |
| 15 | + | ||
| 16 | + | local peers_list=() | |
| 17 | + | mapfile -t peers_list < <(group::peers "$name") | |
| 18 | + | [[ -z "${peers_list[0]}" ]] && log::wg_warning "Group '${name}' has no peers" && return 0 | |
| 19 | + | ||
| 20 | + | # Build comma-separated peer list for watch filter | |
| 21 | + | # Watch already supports --type filter but not multiple peers | |
| 22 | + | # For now, use follow mode filtered to group peers one at a time | |
Новее
Позже