@openziti/ziti-sdk-nodejs 0.14.2 → 0.15.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/package.json +1 -1
- package/src/ziti_dial.c +0 -2
- package/src/ziti_init.c +17 -6
- package/vcpkg.json +4 -2
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ Please star us.
|
|
|
50
50
|
|
|
51
51
|
# Associated Article(s)
|
|
52
52
|
For more context on this SDK, you may be interested in this
|
|
53
|
-
[article concerning how to secure NodeJS applications](https://openziti.io/securing-nodejs-applications)
|
|
53
|
+
[article concerning how to secure NodeJS applications](https://blog.openziti.io/securing-nodejs-applications)
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
|
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.15.0",
|
|
5
5
|
"main": "./lib/ziti",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "npm run build:init && npm run build:configure && npm run build:make",
|
package/src/ziti_dial.c
CHANGED
|
@@ -328,8 +328,6 @@ napi_value _ziti_dial(napi_env env, const napi_callback_info info) {
|
|
|
328
328
|
napi_throw_error(env, NULL, "Unable to napi_create_threadsafe_function");
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
ziti_set_timeout(ztx, 5*1000);
|
|
332
|
-
|
|
333
331
|
// Init a Ziti connection object, and attach our add-on data to it so we can
|
|
334
332
|
// pass context around between our callbacks, as propagate it all the way out
|
|
335
333
|
// to the JavaScript callbacks
|
package/src/ziti_init.c
CHANGED
|
@@ -31,6 +31,12 @@ static const char *ALL_CONFIG_TYPES[] = {
|
|
|
31
31
|
NULL
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
+
#define ZROK_PROXY_CFG_V1 "zrok.proxy.v1"
|
|
35
|
+
#define ZROK_PROXY_CFG_V1_MODEL(XX, ...) \
|
|
36
|
+
XX(auth_scheme, string, none, auth_scheme, __VA_ARGS__) \
|
|
37
|
+
XX(basic_auth, string, none, basic_auth, __VA_ARGS__) \
|
|
38
|
+
XX(oauth, string, none, oauth, __VA_ARGS__)
|
|
39
|
+
DECLARE_MODEL(zrok_proxy_cfg_v1, ZROK_PROXY_CFG_V1_MODEL)
|
|
34
40
|
|
|
35
41
|
/**
|
|
36
42
|
* This function is responsible for calling the JavaScript callback function
|
|
@@ -86,12 +92,6 @@ void on_ziti_init(ziti_context _ztx, int status, void* ctx) {
|
|
|
86
92
|
// Set the global ztx context variable
|
|
87
93
|
ztx = _ztx;
|
|
88
94
|
|
|
89
|
-
if (status == ZITI_OK) {
|
|
90
|
-
|
|
91
|
-
ziti_set_timeout(ztx, 5*1000);
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
|
|
95
95
|
AddonData* addon_data = (AddonData*)ctx;
|
|
96
96
|
|
|
97
97
|
// Initiate the call into the JavaScript callback.
|
|
@@ -136,18 +136,21 @@ static void on_ziti_event(ziti_context _ztx, const ziti_event_t *event) {
|
|
|
136
136
|
if (event->event.service.removed != NULL) {
|
|
137
137
|
for (ziti_service **sp = event->event.service.removed; *sp != NULL; sp++) {
|
|
138
138
|
// service_check_cb(ztx, *sp, ZITI_SERVICE_UNAVAILABLE, app_ctx);
|
|
139
|
+
ZITI_NODEJS_LOG(INFO, "Service removed [%s]", (*sp)->name);
|
|
139
140
|
}
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
if (event->event.service.added != NULL) {
|
|
143
144
|
for (ziti_service **sp = event->event.service.added; *sp != NULL; sp++) {
|
|
144
145
|
// service_check_cb(ztx, *sp, ZITI_OK, app_ctx);
|
|
146
|
+
ZITI_NODEJS_LOG(INFO, "Service added [%s]", (*sp)->name);
|
|
145
147
|
}
|
|
146
148
|
}
|
|
147
149
|
|
|
148
150
|
if (event->event.service.changed != NULL) {
|
|
149
151
|
for (ziti_service **sp = event->event.service.changed; *sp != NULL; sp++) {
|
|
150
152
|
// service_check_cb(ztx, *sp, ZITI_OK, app_ctx);
|
|
153
|
+
ZITI_NODEJS_LOG(INFO, "Service changed [%s]", (*sp)->name);
|
|
151
154
|
}
|
|
152
155
|
}
|
|
153
156
|
|
|
@@ -160,6 +163,11 @@ static void on_ziti_event(ziti_context _ztx, const ziti_event_t *event) {
|
|
|
160
163
|
.hostname = {0},
|
|
161
164
|
.port = 0
|
|
162
165
|
};
|
|
166
|
+
zrok_proxy_cfg_v1 zrok_cfg = {
|
|
167
|
+
.auth_scheme = "",
|
|
168
|
+
.basic_auth = "",
|
|
169
|
+
.oauth = ""
|
|
170
|
+
};
|
|
163
171
|
|
|
164
172
|
if (ziti_service_get_config(s, ZITI_INTERCEPT_CFG_V1, intercept, (int (*)(void *, const char *, size_t))parse_ziti_intercept_cfg_v1) == ZITI_OK) {
|
|
165
173
|
|
|
@@ -177,6 +185,9 @@ static void on_ziti_event(ziti_context _ztx, const ziti_event_t *event) {
|
|
|
177
185
|
|
|
178
186
|
} else if (ziti_service_get_config(s, ZITI_CLIENT_CFG_V1, &clt_cfg, (int (*)(void *, const char *, unsigned long))parse_ziti_client_cfg_v1) == ZITI_OK) {
|
|
179
187
|
track_service_to_hostname(s->name, clt_cfg.hostname.addr.hostname, clt_cfg.port);
|
|
188
|
+
|
|
189
|
+
} else if (ziti_service_get_config(s, ZROK_PROXY_CFG_V1, &zrok_cfg, (int (*)(void *, const char *, unsigned long))parse_ziti_client_cfg_v1) == ZITI_OK) {
|
|
190
|
+
track_service_to_hostname(s->name, s->name, 80);
|
|
180
191
|
}
|
|
181
192
|
|
|
182
193
|
free_ziti_intercept_cfg_v1(intercept);
|