The best way I can think to do this is to use the ZeroTier Central API.
You can go to this link for instructions: ZeroTier Central API | ZeroTier Documentation</title
You’ll need to create an API token in your accounts section. Here’s a quick Python script you can run from your node (can actually be run from any node) to list all of the peers and their IPs:
import requests
import json
# Replace 'insert_zerotier_central_api_token' with your actual token
token = 'insert_zerotier_central_api_token'
# Define the API endpoint URL; replace insert_network_id with your network id
url = 'https://api.zerotier.com/api/v1/network/insert_network_id/member'
# Create headers with the Authorization token
headers = {
'Authorization': f'token {token}'
}
# Send the GET request
response = requests.get(url, headers=headers)
# Check the response status code
if response.status_code == 200:
# Request was successful, you can access the response content
network_data = response.json()
for i in network_data:
print(f"{i['config']['address']} {i['config']['ipAssignments']}")
else:
# Request failed, handle the error
print(f"Failed to retrieve data. Status code: {response.status_code}")
I wrote a Contextual CLI here: ZT Contextual CLI - #2 by l0crian
I can make an update to it for something like “show peers detail” and it could reach out to the ZeroTier Central API to get more information.