summaryrefslogtreecommitdiff
path: root/controller
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-16 16:32:13 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-16 16:32:13 -0700
commitcf51961d523222815cde064d88955aee88352eb5 (patch)
tree5acbd2c1ce94af64ba9c0cff1669a8d200bb11fc /controller
parentc9fd8de007540df6f0d2ae7ad07b1c9daa128b93 (diff)
downloadinfinitytier-cf51961d523222815cde064d88955aee88352eb5.tar.gz
infinitytier-cf51961d523222815cde064d88955aee88352eb5.zip
.
Diffstat (limited to 'controller')
-rw-r--r--controller/zt1-controller-client/index.js64
-rw-r--r--controller/zt1-controller-client/package.json14
-rw-r--r--controller/zt1-controller-client/test-controller.js14
3 files changed, 0 insertions, 92 deletions
diff --git a/controller/zt1-controller-client/index.js b/controller/zt1-controller-client/index.js
deleted file mode 100644
index b262ae8b..00000000
--- a/controller/zt1-controller-client/index.js
+++ /dev/null
@@ -1,64 +0,0 @@
-'use strict'
-
-var request = require('request');
-
-function ZT1ControllerClient(url,authToken)
-{
- this.url = url;
- this.authToken = authToken;
-}
-
-ZT1ControllerClient.prototype.status = function(callback)
-{
- request({
- url: this.url + 'controller',
- method: 'GET',
- headers: {
- 'X-ZT1-Auth': this.authToken
- }
- },function(error,response,body) {
- if (error)
- return callback(error,{});
- if (response.statusCode !== 200)
- return callback(new Error('server responded with '+response.statusCode),{});
- var controllerStatus = JSON.parse(body);
- if (controllerStatus.controller === true) {
- request({
- url: this.url + 'status',
- method: 'GET',
- headers: {
- 'X-ZT1-Auth': this.authToken
- }
- },function(error,response,body) {
- if (error)
- return callback(error,{});
- if (response.statusCode !== 200)
- return callback(new Error('server responded with '+response.statusCode),{});
- var nodeStatus = JSON.parse(body);
- for(var k in controllerStatus)
- nodeStatus[k] = controllerStatus[k];
- return callback(null,nodeStatus);
- }.bind(this));
- } else return callback(new Error('No "controller==true" test value present.'),{});
- }.bind(this));
-};
-
-ZT1ControllerClient.prototype.listNetworks = function(callback)
-{
- request({
- url: this.url + 'controller/network',
- method: 'GET',
- headers: {
- 'X-ZT1-Auth': this.authToken
- }
- },function(error,response,body) {
- if (error)
- return callback(error,{});
- if (response.statusCode !== 200)
- return callback(new Error('server responded with '+response.statusCode),{});
- var r = JSON.parse(body);
- return callback(null,Array.isArray(r) ? r : []);
- });
-};
-
-exports.ZT1ControllerClient = ZT1ControllerClient;
diff --git a/controller/zt1-controller-client/package.json b/controller/zt1-controller-client/package.json
deleted file mode 100644
index 8eda13ad..00000000
--- a/controller/zt1-controller-client/package.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "zt1-controller-client",
- "version": "1.0.0",
- "description": "ZeroTier One network controller client for NodeJS",
- "main": "index.js",
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "author": "ZeroTier, Inc.",
- "license": "BSD",
- "dependencies": {
- "request": "^2.55.0"
- }
-}
diff --git a/controller/zt1-controller-client/test-controller.js b/controller/zt1-controller-client/test-controller.js
deleted file mode 100644
index cddff031..00000000
--- a/controller/zt1-controller-client/test-controller.js
+++ /dev/null
@@ -1,14 +0,0 @@
-var ZT1ControllerClient = require('./index.js').ZT1ControllerClient;
-
-var zt1c = new ZT1ControllerClient('http://127.0.0.1:9993/','5d6181b71fae2684f9cc64ed');
-
-zt1c.status(function(err,status) {
- if (err)
- console.log(err);
- console.log(status);
- zt1c.listNetworks(function(err,networks) {
- if (err)
- console.log(err);
- console.log(networks);
- });
-});