The basic structure of this project:
.
├── api/ # Protocol Buffers
├── docker/
│ ├── base
│ └── remote-network-simulation
├── docs/ # Documentation
├── go/ # Go Modules
│ ├── 0kn/ # 0KN; integrated launcher, libs
│ └── trellis/ # Trellis
└── scripts/
├── go-workspace-init.sh # init go workspace for local dev
├── simulate-remote-network.sh # run remote network simulation
├── test-gateway-ci.sh # full gateway test
├── test-gateway-io.sh # test gateway I/O
└── test-gateway-pipe.sh # test gateway pipe
>= 1.21
Optional; for generating code from Protocol Buffers:
Utilities used by test scripts:
Prepare go workspace:
make init
(Optional) Generate code from Protocol Buffers:
make protobuf
Build:
make build
make test
Typical invocation involves sub processes and various config files within a working directory so installation is necessary. The following is an example:
# build and install executable(s) to directory `go env GOBIN`
make install
# optional: set working directory; see Environment Variables
# `xtrellis` should now be in your PATH
xtrellis --help
# run complete gateway test run by ci
./scripts/test-gateway-ci.sh
# remove installed executable(s)
make uninstall
_0KN_WORKDIR
runtime working directory; default = ~/.0KN
./scripts/test-gateway-ci.sh
Run a coordinated local mix-net with gateway enabled, for example:
xtrellis coordinator mixnet --gatewayenable --debug
CTRL-C
to exit.
Then, in a separate terminal (from project root):
Send 100KB
random data through the mix-net and compare data in/out:
./scripts/test-gateway-io.sh 102400
Pipe generic data through the mix-net:
cat in.png | ./scripts/test-gateway-pipe.sh > out.png
cd docker/base
# build and run container for gateway test
docker compose --profile test-gateway up --build --abort-on-container-exit
# remove container
docker compose --profile test-gateway down
# build docker images
make docker-images
# run remote network simulator
./scripts/simulate-remote-network.sh
# optional: ssh into coordinator's container
cd docker/remote-network-simulation
./coordinator-ssh.sh
# remove containers
make docker-clean