@openziti/ziti-sdk-nodejs 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/dial.js +66 -0
- package/lib/serviceAvailable.js +47 -0
- package/lib/ziti.js +10 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<br>
|
|
9
9
|
<br>
|
|
10
10
|
<b>
|
|
11
|
-
A NodeJS-based SDK for delivering secure applications over a
|
|
11
|
+
A NodeJS-based SDK for delivering secure applications over a <a href="https://openziti.io">Ziti Network</a>
|
|
12
12
|
<br>
|
|
13
13
|
<br>
|
|
14
14
|
<b>Part of the <a href="https://openziti.io/about">OpenZiti</a> ecosystem</b>
|
package/lib/dial.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Netfoundry, Inc.
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* on_connect()
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
const on_connect = ( status ) => {
|
|
24
|
+
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* on_data()
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
const on_data = ( status ) => {
|
|
32
|
+
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* dial()
|
|
38
|
+
*
|
|
39
|
+
* @param {*} serviceName
|
|
40
|
+
* @param {*} isWebSocket
|
|
41
|
+
* @param {*} on_connect_cb callback
|
|
42
|
+
* @param {*} on_data_cb callback
|
|
43
|
+
*/
|
|
44
|
+
const dial = ( serviceName, isWebSocket, on_connect_cb, on_data_cb ) => {
|
|
45
|
+
|
|
46
|
+
let connect_cb;
|
|
47
|
+
let data_cb;
|
|
48
|
+
|
|
49
|
+
if (typeof on_connect_cb === 'undefined') {
|
|
50
|
+
connect_cb = on_connect;
|
|
51
|
+
} else {
|
|
52
|
+
connect_cb = on_connect_cb;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (typeof on_data_cb === 'undefined') {
|
|
56
|
+
data_cb = on_data;
|
|
57
|
+
} else {
|
|
58
|
+
data_cb = on_data_cb;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
ziti.ziti_dial(serviceName, isWebSocket, connect_cb, data_cb);
|
|
62
|
+
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
exports.dial = dial;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright Netfoundry, Inc.
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* on_serviceAvailable()
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
const on_serviceAvailable = ( status ) => {
|
|
23
|
+
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* write()
|
|
29
|
+
*
|
|
30
|
+
* @param {*} service
|
|
31
|
+
* @param {*} on_write callback
|
|
32
|
+
*/
|
|
33
|
+
const serviceAvailable = ( service, sa_cb ) => {
|
|
34
|
+
|
|
35
|
+
let cb;
|
|
36
|
+
|
|
37
|
+
if (typeof sa_cb === 'undefined') {
|
|
38
|
+
cb = on_serviceAvailable;
|
|
39
|
+
} else {
|
|
40
|
+
cb = sa_cb;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
ziti.ziti_service_available( service, cb );
|
|
44
|
+
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
exports.serviceAvailable = serviceAvailable;
|
package/lib/ziti.js
CHANGED
|
@@ -43,11 +43,13 @@ ziti = module.exports = exports = binding;
|
|
|
43
43
|
/**
|
|
44
44
|
* Attach the external, app-facing, API to the 'ziti' object
|
|
45
45
|
*/
|
|
46
|
-
exports.close
|
|
47
|
-
exports.
|
|
48
|
-
exports.
|
|
49
|
-
exports.
|
|
50
|
-
exports.
|
|
51
|
-
exports.
|
|
52
|
-
exports.
|
|
53
|
-
exports.setLogLevel
|
|
46
|
+
exports.close = require('./close').close;
|
|
47
|
+
exports.dial = require('./dial').dial;
|
|
48
|
+
exports.express = require('./express').express;
|
|
49
|
+
exports.httpRequest = require('./httpRequest').httpRequest;
|
|
50
|
+
exports.httpRequestData = require('./httpRequestData').httpRequestData;
|
|
51
|
+
exports.init = require('./init').init;
|
|
52
|
+
exports.listen = require('./listen').listen;
|
|
53
|
+
exports.setLogLevel = require('./setLogLevel').setLogLevel;
|
|
54
|
+
exports.serviceAvailable = require('./serviceAvailable').serviceAvailable;
|
|
55
|
+
exports.write = require('./write').write;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openziti/ziti-sdk-nodejs",
|
|
3
3
|
"description": "A NodeJS-based SDK for delivering secure applications over a Ziti Network",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"main": "./lib/ziti",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "npm run build:init; npm run build:c-sdk; npm install --build-from-source --clang=1",
|