mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-20 21:33:57 -07:00
Some nodeJS work, and apply fix from GitHub issue #166 plus a small optimization to avoid repeated calls to _allMulticastGroups().
This commit is contained in:
parent
d8ad555b9a
commit
5e3c6d9e0d
3 changed files with 50 additions and 20 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue