summaryrefslogtreecommitdiff
path: root/examples/api
diff options
context:
space:
mode:
authorGrant Limberg <glimberg@gmail.com>2015-11-02 18:32:21 -0800
committerGrant Limberg <glimberg@gmail.com>2015-11-02 18:32:21 -0800
commit179b064b05460b706526a3249a25cd07232a42f5 (patch)
treed26dfeb2c02ce59c4a531142684695e45bb515ad /examples/api
parent75a191a8564030f4d5e99aca76b980e2d69abd20 (diff)
parent4e9d4304761f93a1764d3ec2d2b0c38140decad8 (diff)
downloadinfinitytier-179b064b05460b706526a3249a25cd07232a42f5.tar.gz
infinitytier-179b064b05460b706526a3249a25cd07232a42f5.zip
Merge branch 'edge' into android-jni-dev
Diffstat (limited to 'examples/api')
-rw-r--r--examples/api/README.md26
-rw-r--r--examples/api/circuit-test-pingpong.json13
-rw-r--r--examples/api/public.json27
3 files changed, 66 insertions, 0 deletions
diff --git a/examples/api/README.md b/examples/api/README.md
new file mode 100644
index 00000000..50b1b65e
--- /dev/null
+++ b/examples/api/README.md
@@ -0,0 +1,26 @@
+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.
+
+---
+
+**public.json**: A valid configuration for a public network that allows IPv4 and IPv6 traffic.
+
+**circuit-test-pingpong.json**: An example circuit test that can be posted to /controller/network/################/test to order a test -- you will have to edit this to insert the hops you want since the two hard coded device IDs are from our own test instances.
diff --git a/examples/api/circuit-test-pingpong.json b/examples/api/circuit-test-pingpong.json
new file mode 100644
index 00000000..8fcc5d94
--- /dev/null
+++ b/examples/api/circuit-test-pingpong.json
@@ -0,0 +1,13 @@
+{
+ "hops": [
+ [ "4cbc810d4c" ],
+ [ "868cd1664f" ],
+ [ "4cbc810d4c" ],
+ [ "868cd1664f" ],
+ [ "4cbc810d4c" ],
+ [ "868cd1664f" ],
+ [ "4cbc810d4c" ],
+ [ "868cd1664f" ]
+ ],
+ "reportAtEveryHop": true
+}
diff --git a/examples/api/public.json b/examples/api/public.json
new file mode 100644
index 00000000..4317bd3e
--- /dev/null
+++ b/examples/api/public.json
@@ -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"
+ }]
+}