ziti-sdk-nodejs
A NodeJS-based SDK for delivering secure applications over a Ziti Network
Learn about Ziti at ziti.dev
Supported platforms
The ziti-sdk-nodejs
module works with Node.js v11.x, v12.x, v13.x, v14.x
Binaries for most Node versions and platforms are provided by default via node-pre-gyp.
Usage
Note: the module must be installed before use.
var ziti = require('ziti-sdk-nodejs');
const ziti_init = async (identity) => {
return new Promise((resolve) => {
ziti.ziti_init(identity, () => {
resolve();
});
});
};
const ziti_service_available = (service) => {
return new Promise((resolve) => {
ziti.ziti_service_available(service, (status) => {
resolve(status);
});
});
};
function ziti_dial(service) {
return new Promise((resolve, reject) => {
ziti.ziti_dial(
service,
(conn) => {
resolve(conn);
},
(data) => {
// Do something with data...
},
);
});
}
const ziti_write = (conn, data) => {
return new Promise((resolve) => {
ziti.ziti_write(conn, data, () => {
resolve();
});
});
};
(async () => {
await ziti_init(LOCATION_OF_IDENTITY_FILE);
let status = await ziti_service_available(YOUR_SERVICE_NAME);
if (status === 0) {
const conn = await ziti_dial(YOUR_SERVICE_NAME);
let data = SOME_KIND_OF_DATA;
let buffer = Buffer.from(data);
await ziti_write(conn, buffer);
...etc
}
})();
Ziti NodeJS SDK - Setup for Development
The following steps should get your NodeJS SDK for Ziti building. The Ziti NodeJS SDK is a native addon for Node JS, and is written in C. C development is specific to your operating system and tool chain used. These steps should work properly for you but if your OS has variations you may need to adapt these steps accordingly.
Prerequisites
Build
Build
Linux/MacOS
Building the NodeJS SDK on linux/mac can be accomplished with:
$ npm run build
Getting Help
Please use these community resources for getting help. We use GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them.
- Read the docs
- Join our Developer Community
- Participate in discussion on Discourse
Copyright© 2018-2020. NetFoundry, Inc.