summaryrefslogtreecommitdiff
path: root/nodejs-zt1-client
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-25 14:21:05 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-05-25 14:21:05 -0700
commit5e3c6d9e0d89b8284cf60978b658dab12d2814d1 (patch)
treeaeb14563cb9b1061f9e0f5fb3f7697393052a7e1 /nodejs-zt1-client
parentd8ad555b9ad7d70f6733f3d1e2ef795c752f45a4 (diff)
downloadinfinitytier-5e3c6d9e0d89b8284cf60978b658dab12d2814d1.tar.gz
infinitytier-5e3c6d9e0d89b8284cf60978b658dab12d2814d1.zip
Some nodeJS work, and apply fix from GitHub issue #166 plus a small optimization to avoid repeated calls to _allMulticastGroups().
Diffstat (limited to 'nodejs-zt1-client')
-rw-r--r--nodejs-zt1-client/index.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/nodejs-zt1-client/index.js b/nodejs-zt1-client/index.js
index f61e3b54..55f7fb24 100644
--- a/nodejs-zt1-client/index.js
+++ b/nodejs-zt1-client/index.js
@@ -8,6 +8,25 @@ function ZT1Client(url,authToken)
this.authToken = authToken;
}
+// Generate new ZeroTier identity -- mostly for testing
+ZT1Client.prototype.newIdentity = function(callback)
+{
+ request({
+ url: this.url + 'newIdentity',
+ method: 'GET',
+ json: false,
+ headers: {
+ 'X-ZT1-Auth': this.authToken
+ }
+ },function(error,response,body) {
+ if (error)
+ return callback(error,null);
+ if (response.statusCode === 200)
+ return callback(null,body);
+ return callback(new Error('server responded with error: '+response.statusCode),'');
+ });
+}
+
ZT1Client.prototype._jsonGet = function(getPath,callback)
{
request({
@@ -134,4 +153,8 @@ ZT1Client.prototype.saveControllerNetwork = function(network,callback)
});
};
+ZT1Client.prototype.getControllerNetworkMember = function(nwid,address,callback) {
+ this._jsonGet('controller/network/' + nwid + '/member/' + address,callback);
+};
+
exports.ZT1Client = ZT1Client;