mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-16 10:03:14 -07:00
Basic controller JSON API seems to be working.
This commit is contained in:
parent
cf51961d52
commit
69ceb7e730
5 changed files with 397 additions and 292 deletions
33
nodejs-zt1-client/test.js
Normal file
33
nodejs-zt1-client/test.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
var ZT1Client = require('./index.js').ZT1Client;
|
||||
|
||||
var zt1c = new ZT1Client('http://127.0.0.1:9993/','5d6181b71fae2684f9cc64ed');
|
||||
|
||||
zt1c.status(function(err,status) {
|
||||
if (err)
|
||||
console.log(err);
|
||||
else console.log(status);
|
||||
|
||||
zt1c.getNetworks(function(err,networks) {
|
||||
if (err)
|
||||
console.log(err);
|
||||
else console.log(networks);
|
||||
|
||||
zt1c.getPeers(function(err,peers) {
|
||||
if (err)
|
||||
console.log(err);
|
||||
else console.log(peers);
|
||||
|
||||
if (status.controller) {
|
||||
zt1c.saveControllerNetwork({
|
||||
nwid: status.address + 'dead01',
|
||||
name: 'test network',
|
||||
private: true
|
||||
},function(err,network) {
|
||||
if (err)
|
||||
console.log(err);
|
||||
else console.log(network);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue