[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [bridgedb/master] Add script for using curl to test moat's JSON API.



commit 0c24fa3719aa29e967ca5804e8eaaab80af17e32
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
Date:   Tue Sep 12 21:33:22 2017 +0000

    Add script for using curl to test moat's JSON API.
---
 scripts/test-moat | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/scripts/test-moat b/scripts/test-moat
new file mode 100755
index 0000000..6bfa500
--- /dev/null
+++ b/scripts/test-moat
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+function usage() {
+    printf "Usage: %s [fetch] [check]\n" "$(basename $0)"
+}
+
+if test "$#" -lt 1 ; then
+    usage
+    exit 1
+fi
+
+function do_fetch() {
+    curl -H 'Content-Type: application/vnd.api+json' \
+         -H 'Accept: application/vnd.api+json' \
+         --data '{"data": [{"supported": ["obfs4"], "version": "0.1.0", "type": "client-transports"}]}' \
+         http://127.0.0.1:6790/meek/moat/fetch
+    echo
+}
+
+function do_check() {
+    curl -H 'Content-Type: application/vnd.api+json' \
+         -H 'Accept: application/vnd.api+json' \
+         --data '{"data": [{"challenge": "foo", "solution": "bar", "version": "0.1.0", "qrcode": "false", "type": "moat-solution", "id": 2, "transport": "obfs4"}]}' \
+         http://127.0.0.1:6790/meek/moat/check
+    echo
+}
+
+while test -n "$1" ; do
+    case "$1" in
+        fetch) do_fetch ;;
+        check) do_check ;;
+        *) usage ;;
+    esac
+
+    shift
+done



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits