summaryrefslogtreecommitdiff
path: root/examples/list-tokens.sh
diff options
context:
space:
mode:
Diffstat (limited to 'examples/list-tokens.sh')
-rwxr-xr-xexamples/list-tokens.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/list-tokens.sh b/examples/list-tokens.sh
new file mode 100755
index 0000000..1dfc051
--- /dev/null
+++ b/examples/list-tokens.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# vim: set sts=2 sw=2 et tw=0 :
+#
+
+HOST="http://localhost:8000"
+
+caps="application/x-rtp, media=(string)video"
+start_port=5004
+end_port=5018
+udp_clients="localhost:$start_port"
+
+set -e
+
+add_tokens() {
+ local id
+ for port in $(seq $((start_port)) $end_port); do
+ id=$(date +%H%M%S)-$RANDOM
+ curl -s -X POST "$HOST/add-token?sessionid=$id&type=http,rtp-udp&udp-clients=localhost:$port"
+ done
+}
+
+list_tokens() {
+ curl -s -X GET "$HOST/list-tokens"
+ echo
+}
+
+revoke_tokens() {
+ local id
+ list_sessionids | while read id; do
+ curl -s -X DELETE "$HOST/revoke-token?sessionid=$id"
+ done
+}
+
+list_tokens