basic handler [CI SKIP]
This commit is contained in:
parent
678987fbbd
commit
34a081c6d6
34
handler.sh
Normal file
34
handler.sh
Normal file
@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
#{event} {id} {allowed_ips} {endpoint} {last_handshake} {persistent_keepalive} {traffic}
|
||||
EVENT=$1
|
||||
PUB_KEY=$2
|
||||
IFS=',' read -ra ALLOWED_IPS <<< "$3"
|
||||
ENDPOINT=$4
|
||||
LAST_HSHAKE=$5
|
||||
KEEPALIVE=$6
|
||||
IFS=',' read -ra TRAFFIC <<< "$7"
|
||||
TX_BYTES=${TRAFFIC[0]}
|
||||
RX_BYTES=${TRAFFIC[1]}
|
||||
|
||||
echo "Caught event $EVENT for $PUB_KEY with IP $ALLOWED_IPS last shaked: $LAST_HSHAKE" > /tmp/log
|
||||
|
||||
case "$EVENT" in
|
||||
"connected")
|
||||
|
||||
;;
|
||||
"disconnected")
|
||||
|
||||
;;
|
||||
"roaming")
|
||||
PREV_ENDPOINT=$8
|
||||
;;
|
||||
"added")
|
||||
;;
|
||||
"removed")
|
||||
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
Loading…
x
Reference in New Issue
Block a user