blob: 640d97b010bd2536340d40fe9282ac642c1d40ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# Python example
This example demonstrates how to use the ZeroTier socket interface provided by libzt in a Python application. The API is designed to be a drop-in replacement for the Python [Low-level networking interface](https://docs.python.org/3/library/socket.html).
Note: Only `AF_INET` and `AF_INET6` address families are supported.
### Install
```
pip install libzt
```
### Run
```
python3 example.py server id-path/bob 0123456789abcdef 9997 8080
python3 example.py client id-path/alice 0123456789abcdef 9996 11.22.33.44 8080
```
*Where `9996` and `9997` are arbitrary ports that you allow ZeroTier to use for encrypted UDP traffic, port `8080` is an arbitrary port used by the client/server socket code, and `11.22.33.44` should be whatever IP address the network assigns your node.*
### Implementation Details
- See [src/bindings/python](../../src/bindings/python)
|