Skip to content

Commit

Permalink
feat(bin): add xtrellis/bin/test-gateway-io.sh
Browse files Browse the repository at this point in the history
script for testing mix-net data in/out by means of the gateway
  • Loading branch information
xendarboh committed Oct 2, 2023
1 parent afb1423 commit 9f1bc1f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cmd/xtrellis/bin/test-gateway-io.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

# Test transmission of data streams through mix-net by means of gateway proxy i/o

# Example coordinated local mix-net invocation before running this:
# ./xtrellis coordinator --messagesize 120 --numlayers 5 --numusers 3 --roundinterval 1 --gatewayenable --debug

set -e

# bytes of data to send through the mix-net (default 10K)
DATA_SIZE=${1:-10240}

cd /tmp
rm -f data.{in,out}

# random -> file
cat /dev/urandom | head -c ${DATA_SIZE} > data.in
# dd if=/dev/urandom of=data.in bs=1024 count=10 &>/dev/null

# file -> gateway -> [mix-net]
cat data.in | nc -q 1 localhost 9000

# [mix-net] -> gateway -> file
wget -O data.out -q http://localhost:9900 || echo "not found"

# compare data input to output
if diff -q data.in data.out &>/dev/null; then
echo "Success!"
else
echo "Fail!"
fi

0 comments on commit 9f1bc1f

Please sign in to comment.