Skip to content

Commit

Permalink
Merge pull request #1 from hanjo/main
Browse files Browse the repository at this point in the history
Add support for specifying interface name as command line argument
  • Loading branch information
IndrekHaav authored Oct 31, 2024
2 parents 42f2135 + a82a756 commit 49fc22f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wgmon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
# Source: https://github.com/IndrekHaav/wgmon-edgeos

cmd="/opt/vyatta/bin/vyatta-op-cmd-wrapper"
interface="wg0"
interface="${1:-}"

declare -A wg_peers
while read -r -a peer; do
pubkey="${peer[5]}"
name="${peer[7]}"
wg_peers["$pubkey"]="$name"
done < <($cmd show configuration commands | grep "wireguard $interface peer .* description")
done < <($cmd show configuration commands | grep "wireguard .* peer .* description")

status=$(script -e -q -c "sudo wg show $interface" /dev/null | cat)
status=$(script -e -q -c "sudo wg show ${interface}" /dev/null | cat)

for key in "${!wg_peers[@]}"; do
name="${wg_peers[$key]}"
Expand Down

0 comments on commit 49fc22f

Please sign in to comment.