forked from SimonLangowski/trellis
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bin): add xtrellis/bin/test-gateway-io.sh
script for testing mix-net data in/out by means of the gateway
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |