nuno hat die Gist bearbeitet 1 month ago. Zu Änderung gehen
1 file changed, 41 insertions
gistfile1.txt(Datei erstellt)
| @@ -0,0 +1,41 @@ | |||
| 1 | + | sed -n '/^function cmd::test::section_peer_cmd/,/^}/p' \ | |
| 2 | + | /etc/wireguard/wgctl/commands/test/integration.sh | |
| 3 | + | function cmd::test::section_peer_cmd() { | |
| 4 | + | test::section "Peer command" | |
| 5 | + | ||
| 6 | + | "$WGCTL_BINARY" remove --name phone-testunit --force > /dev/null 2>&1 || true | |
| 7 | + | "$WGCTL_BINARY" add --name testunit --type phone > /dev/null 2>&1 | |
| 8 | + | ||
| 9 | + | # update-dns | |
| 10 | + | cmd::test::run_cmd "peer update-dns --name" "Updated DNS" peer update-dns --name phone-testunit | |
| 11 | + | cmd::test::run_cmd "peer update-dns applies" "10.0.0.103" config --name phone-testunit | |
| 12 | + | cmd::test::run_cmd "peer update-dns --all" "peer(s)" peer update-dns --all | |
| 13 | + | ||
| 14 | + | # update-tunnel | |
| 15 | + | cmd::test::run_cmd "peer update-tunnel split" "split" peer update-tunnel --name phone-testunit --mode split | |
| 16 | + | cmd::test::run_cmd "peer update-tunnel full" "Updated" peer update-tunnel --name phone-testunit --mode full | |
| 17 | + | cmd::test::run_cmd_fails "peer update-tunnel bad mode" peer update-tunnel --name phone-testunit --mode invalid | |
| 18 | + | cmd::test::run_cmd_fails "peer update-tunnel missing --mode" peer update-tunnel --name phone-testunit | |
| 19 | + | cmd::test::run_cmd_fails "peer update-tunnel missing --name" peer update-tunnel --mode split | |
| 20 | + | ||
| 21 | + | # Restore split tunnel | |
| 22 | + | "$WGCTL_BINARY" peer update-tunnel --name phone-testunit --mode split > /dev/null 2>&1 || true | |
| 23 | + | "$WGCTL_BINARY" remove --name phone-testunit --force > /dev/null 2>&1 || true | |
| 24 | + | } | |
| 25 | + | ||
| 26 | + | function cmd::test::section_logs() { | |
| 27 | + | test::section "Logs" | |
| 28 | + | cmd::test::run_cmd "logs" "Activity" logs | |
| 29 | + | cmd::test::run_cmd "logs --name phone-nuno" "Activity" logs --name phone-nuno | |
| 30 | + | cmd::test::run_cmd "logs --fw" "Firewall Drops" logs --fw | |
| 31 | + | cmd::test::run_cmd "logs --wg" "WireGuard Events" logs --wg | |
| 32 | + | cmd::test::run_cmd "logs --since 2099-01-01" "No logs" logs --since "2099-01-01" | |
| 33 | + | cmd::test::run_cmd "logs --wg --since 2099-01-01" "No logs" logs --wg --since "2099-01-01" | |
| 34 | + | cmd::test::run_cmd "logs --fw --since 2099-01-01" "No logs" logs --fw --since "2099-01-01" | |
| 35 | + | cmd::test::run_cmd "logs --wg --event attempt" "" logs --wg --event attempt | |
| 36 | + | cmd::test::run_cmd "logs --detailed" "" logs --detailed | |
| 37 | + | cmd::test::run_cmd "logs --resolved" "" logs --resolved | |
| 38 | + | cmd::test::run_cmd "logs --ascending" "" logs --ascending | |
| 39 | + | cmd::test::run_cmd "logs --descending" "" logs --descending | |
| 40 | + | cmd::test::run_cmd "logs --wg --ascending" "" logs --wg --ascending | |
| 41 | + | } | |
Neuer
Älter