Add more helpful example stuff.

This commit is contained in:
Adam Ierymenko 2015-10-09 12:50:52 -07:00
parent 6b5bb0b278
commit 97dee9de36
3 changed files with 48 additions and 1 deletions

20
examples/api/README.md Normal file
View File

@ -0,0 +1,20 @@
API Examples
======
This folder contains examples that can be posted with curl or another http query utility to a local instance.
To test querying with curl:
curl -H 'X-ZT1-Auth:AUTHTOKEN' http://127.0.0.1:9993/status
To create a public network on a local controller (service must be built with "make ZT\_ENABLE\_NETWORK\_CONTROLLER=1"):
curl -H 'X-ZT1-Auth:AUTHTOKEN' -X POST -d @public.json http://127.0.0.1:9993/controller/network/################
Replace AUTHTOKEN with the contents of this instance's authtoken.secret file and ################ with a valid network ID. Its first 10 hex digits must be the ZeroTier address of the controller itself, while the last 6 hex digits can be anything. Also be sure to change the port if you have this instance listening somewhere other than 9993.
After POSTing you can double check the network config with:
curl -H 'X-ZT1-Auth:AUTHTOKEN' http://127.0.0.1:9993/controller/network/################
Once this network is created (and if your controller is online, etc.) you can then join this network from any device anywhere in the world and it will receive a valid network configuration.

27
examples/api/public.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "public_test_network",
"private": false,
"enableBroadcast": true,
"allowPassiveBridging": false,
"v4AssignMode": "zt",
"v6AssignMode": "rfc4193",
"multicastLimit": 32,
"relays": [],
"gateways": [],
"ipLocalRoutes": ["10.66.0.0/16"],
"ipAssignmentPools": [{"ipRangeStart":"10.66.0.1","ipRangeEnd":"10.66.255.254"}],
"rules": [
{
"ruleNo": 10,
"etherType": 2048,
"action": "accept"
},{
"ruleNo": 20,
"etherType": 2054,
"action": "accept"
},{
"ruleNo": 30,
"etherType": 34525,
"action": "accept"
}]
}

View File

@ -2,7 +2,7 @@ FROM centos:7
MAINTAINER https://www.zerotier.com/
RUN yum -y update && yum clean all
RUN yum -y update && yum install -y sqlite net-tools && yum clean all
EXPOSE 9993/udp