This project shows how to easily Zitify(run dark on zero trust overlay network) your Golang MQTT server and clients.
- Get your code -- clone this repo
- Get yourself an OpenZiti network and Ziti identities
- follow quickstart or, use Ziti Edge Developer Sandbox
- create a Ziti service that will be used to for MQTT communication
- add/enroll Ziiti identities
- build this project
this creates
$ mkdir build && go build -o build ./...
mqziti_server
andmqziti_client
in your build directory
This following is assumed for the rest of this document:
- 'mqziti' - the name of the service we are going to use
server.json
- Ziti identity file for the serverclient.json
- Ziti identity for the client
We use Mochi MQTT as base and implement a
Listener
that binds to the Ziti service.
Run the server
$ ./build/mqziti_server -identity server.json -service mqziti
You can check that the process has no listening sockets. This means that you need to open your firewall.
We use Paho MQTT and implement a connector that connects to Ziti service.
You will need to run mqziti_client
twice for this test: one instance to subscribe, and one instance to publish.
Subscriber:
$ ./build/mqziti_client -identity client.json -service mqziti -topic /openziti
Publish something:
$ ./build/mqziti_client -identity client.json -service mqziti -topic /openziti -pub "Hello OpenZiti!"
You should see the message printed on the subscriber console.
- Follow our Blog
- Join Discussion
- Development
- Documentation