Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zrok support; update c-sdk to 0.36.9 #80

Merged
merged 7 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/ziti-sdk-c
Submodule ziti-sdk-c updated 71 files
+216 −0 .clang-format
+9 −6 .github/actions/build/action.yml
+3 −3 .github/workflows/cmake.yml
+17 −0 .github/workflows/linters.yml
+1 −1 BUILD.md
+2 −15 CODE_OF_CONDUCT.md
+1 −1 CONTRIBUTING.md
+1 −0 CONTRIBUTORS
+1 −1 LICENSE
+15 −14 README.md
+12 −0 SECURITY.md
+1 −1 cmake/version.cmake
+1 −1 deps/CMakeLists.txt
+0 −68 git.cmake
+50 −15 inc_internal/edge_protocol.h
+21 −14 inc_internal/internal_model.h
+3 −1 inc_internal/message.h
+3 −0 inc_internal/pool.h
+5 −3 inc_internal/utils.h
+9 −8 inc_internal/ziti_ctrl.h
+45 −23 inc_internal/zt_internal.h
+1 −1 includes/ziti/errors.h
+5 −0 includes/ziti/model_collections.h
+12 −22 includes/ziti/ziti.h
+9 −2 includes/ziti/ziti_model.h
+7 −2 includes/ziti/zitilib.h
+33 −1 library/CMakeLists.txt
+39 −50 library/auth_queries.c
+5 −3 library/authenticators.c
+128 −54 library/bind.c
+164 −127 library/channel.c
+6 −2 library/config.c
+74 −2 library/conn_bridge.c
+322 −262 library/connect.c
+20 −3 library/internal_model.c
+44 −5 library/message.c
+12 −0 library/model_collections.c
+5 −3 library/model_support.c
+15 −1 library/pool.c
+11 −14 library/posture.c
+20 −0 library/proto/README.md
+801 −0 library/proto/edge_client.pb-c.c
+310 −0 library/proto/edge_client.pb-c.h
+92 −0 library/proto/edge_client.proto
+105 −0 library/proto/google/protobuf/timestamp.pb-c.c
+151 −0 library/proto/google/protobuf/timestamp.pb-c.h
+96 −0 library/util/future.c
+32 −0 library/util/future.h
+17 −4 library/utils.c
+171 −113 library/ziti.c
+50 −25 library/ziti_ctrl.c
+0 −2 library/ziti_enroll.c
+43 −116 library/zitilib.c
+2 −2 programs/sample-host/sample-host.c
+1 −1 programs/sample_enroll/sample_enroll.c
+81 −0 programs/sample_http_link/README.md
+1 −1 programs/sample_http_link/sample_http_link.c
+1 −1 programs/sample_wttr/sample_wttr.c
+34 −0 programs/ziti-prox-c/proxy.c
+7 −2 programs/zitilib-samples/server.c
+2 −0 tests/CMakeLists.txt
+1 −1 tests/ctrl_tests.cpp
+73 −0 tests/integ/CMakeLists.txt
+91 −0 tests/integ/bootstrap.exp
+23 −0 tests/integ/integ-test.exp
+40 −0 tests/integ/main.cpp
+18 −0 tests/integ/test-data.h.in
+12 −6 tests/message_tests.cpp
+144 −37 tests/test_ziti_model.cpp
+1 −1 tests/ziti_src_tests.cpp
+4 −2 vcpkg.json
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openziti/ziti-sdk-nodejs",
"description": "A NodeJS-based SDK for delivering secure applications over a Ziti Network",
"version": "0.14.2",
"version": "0.15.0",
"main": "./lib/ziti",
"scripts": {
"build": "npm run build:init && npm run build:configure && npm run build:make",
Expand Down
2 changes: 0 additions & 2 deletions src/ziti_dial.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,6 @@ napi_value _ziti_dial(napi_env env, const napi_callback_info info) {
napi_throw_error(env, NULL, "Unable to napi_create_threadsafe_function");
}

ziti_set_timeout(ztx, 5*1000);

// Init a Ziti connection object, and attach our add-on data to it so we can
// pass context around between our callbacks, as propagate it all the way out
// to the JavaScript callbacks
Expand Down
23 changes: 17 additions & 6 deletions src/ziti_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ static const char *ALL_CONFIG_TYPES[] = {
NULL
};

#define ZROK_PROXY_CFG_V1 "zrok.proxy.v1"
#define ZROK_PROXY_CFG_V1_MODEL(XX, ...) \
XX(auth_scheme, string, none, auth_scheme, __VA_ARGS__) \
XX(basic_auth, string, none, basic_auth, __VA_ARGS__) \
XX(oauth, string, none, oauth, __VA_ARGS__)
DECLARE_MODEL(zrok_proxy_cfg_v1, ZROK_PROXY_CFG_V1_MODEL)

/**
* This function is responsible for calling the JavaScript callback function
Expand Down Expand Up @@ -86,12 +92,6 @@ void on_ziti_init(ziti_context _ztx, int status, void* ctx) {
// Set the global ztx context variable
ztx = _ztx;

if (status == ZITI_OK) {

ziti_set_timeout(ztx, 5*1000);

}

AddonData* addon_data = (AddonData*)ctx;

// Initiate the call into the JavaScript callback.
Expand Down Expand Up @@ -136,18 +136,21 @@ static void on_ziti_event(ziti_context _ztx, const ziti_event_t *event) {
if (event->event.service.removed != NULL) {
for (ziti_service **sp = event->event.service.removed; *sp != NULL; sp++) {
// service_check_cb(ztx, *sp, ZITI_SERVICE_UNAVAILABLE, app_ctx);
ZITI_NODEJS_LOG(INFO, "Service removed [%s]", (*sp)->name);
}
}

if (event->event.service.added != NULL) {
for (ziti_service **sp = event->event.service.added; *sp != NULL; sp++) {
// service_check_cb(ztx, *sp, ZITI_OK, app_ctx);
ZITI_NODEJS_LOG(INFO, "Service added [%s]", (*sp)->name);
}
}

if (event->event.service.changed != NULL) {
for (ziti_service **sp = event->event.service.changed; *sp != NULL; sp++) {
// service_check_cb(ztx, *sp, ZITI_OK, app_ctx);
ZITI_NODEJS_LOG(INFO, "Service changed [%s]", (*sp)->name);
}
}

Expand All @@ -160,6 +163,11 @@ static void on_ziti_event(ziti_context _ztx, const ziti_event_t *event) {
.hostname = {0},
.port = 0
};
zrok_proxy_cfg_v1 zrok_cfg = {
.auth_scheme = "",
.basic_auth = "",
.oauth = ""
};

if (ziti_service_get_config(s, ZITI_INTERCEPT_CFG_V1, intercept, (int (*)(void *, const char *, size_t))parse_ziti_intercept_cfg_v1) == ZITI_OK) {

Expand All @@ -177,6 +185,9 @@ static void on_ziti_event(ziti_context _ztx, const ziti_event_t *event) {

} 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) {
track_service_to_hostname(s->name, clt_cfg.hostname.addr.hostname, clt_cfg.port);

} 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) {
track_service_to_hostname(s->name, s->name, 80);
}

free_ziti_intercept_cfg_v1(intercept);
Expand Down
6 changes: 4 additions & 2 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
"openssl",
"zlib",
"llhttp",
"libsodium"
"libsodium",
"json-c",
"protobuf-c"
],
"features": {
},
"builtin-baseline": "f14984af3738e69f197bf0e647a8dca12de92996"
}
}
Loading