This example shows how to open a socket to listen on the network overlay for a particular service and send all bytes received back to the sender.
Refer to the examples README for details on setting up your network, service, and obtaining an identity file.
If you haven't already installed them, you'll need the dependent libraries used in the examples.
pip install -r ../requirements
This example accepts two input arguments.
- The identity file to be used by the SDK tunneler to bind to the service
- The service to bind to
python ziti-echo-server.py </path/to/id.json> <name-of-service>
Netcat can be used to test this however, in order to connect to the service over netcat you'll need an identity and a tunneler for the device running the netcat commands. An easy way to set this up is to create an identity that has dial access on the intended service. Then run a tunneler on your platform, and enroll the identity.
If we use netcat to connect to the intercept address and send some data, we will see a response of the exact same data we sent (hence the name, echo server).
nc <name-of-service> <intercept-port>
Hello!
Using a service called python.echo.ziti
on port 80
here is what this would look like.
nc python.echo.ziti 80
Hello
Hello