@openziti/ziti-sdk-nodejs 0.6.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/.github/workflows/build.yml +220 -0
- package/.github/workflows/codeql-analysis.yml +71 -0
- package/.github/workflows/mattermost-ziti-webhook.yml +26 -0
- package/.gitmodules +4 -0
- package/.travis.yml-obsolete +99 -0
- package/CODE_OF_CONDUCT.md +17 -0
- package/CONTRIBUTING.md +6 -0
- package/LICENSE +201 -0
- package/README.md +155 -0
- package/appveyor.yml-obsolete +32 -0
- package/binding.gyp +227 -0
- package/lib/index.js +17 -0
- package/lib/ziti.js +40 -0
- package/package.json +56 -0
- package/scripts/build-appveyor.bat +198 -0
- package/scripts/install_node.sh +99 -0
- package/scripts/validate_tag.sh +24 -0
- package/src/Ziti_https_request.c +960 -0
- package/src/Ziti_https_request_data.c +250 -0
- package/src/Ziti_https_request_end.c +79 -0
- package/src/stack_traces.c +334 -0
- package/src/utils.c +108 -0
- package/src/utils.h +85 -0
- package/src/ziti-add-on.c +88 -0
- package/src/ziti-nodejs.h +209 -0
- package/src/ziti_close.c +79 -0
- package/src/ziti_dial.c +375 -0
- package/src/ziti_enroll.c +245 -0
- package/src/ziti_hello.c +52 -0
- package/src/ziti_init.c +315 -0
- package/src/ziti_service_available.c +222 -0
- package/src/ziti_shutdown.c +47 -0
- package/src/ziti_websocket_connect.c +458 -0
- package/src/ziti_websocket_write.c +235 -0
- package/src/ziti_write.c +223 -0
- package/tests/enroll-test.js +38 -0
- package/tests/hello.js +12 -0
- package/tests/https-test.js +206 -0
- package/tests/mattermost-test.js +124 -0
- package/tests/websocket-test.js +119 -0
- package/ziti.js +1 -0
- package/ziti.png +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
<p align="center" width="100%">
|
|
2
|
+
<a href="https://openziti.io"><img src="ziti.png" width="100"></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<b>
|
|
7
|
+
<a>@openziti/ziti-sdk-nodejs</a>
|
|
8
|
+
<br>
|
|
9
|
+
<br>
|
|
10
|
+
<b>
|
|
11
|
+
A NodeJS-based SDK for delivering secure applications over a [Ziti Network](https://openziti.io)
|
|
12
|
+
<br>
|
|
13
|
+
<br>
|
|
14
|
+
<b>Part of the <a href="https://openziti.io/about">OpenZiti</a> ecosystem</b>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<br>
|
|
19
|
+
<b>Are you interested in knowing how to easily embed programmable, high performance, zero trust networking into your NodeJS app, on any internet connection, without VPNs?
|
|
20
|
+
<br>
|
|
21
|
+
Learn more about our <a href="https://openziti.io/about">OpenZiti</a> project.</b>
|
|
22
|
+
<br>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
[]()
|
|
27
|
+
[]()
|
|
28
|
+
[](https://badge.fury.io/js/@openziti%2Fziti-sdk-nodejs)
|
|
29
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
30
|
+
[]()
|
|
31
|
+
[](CONTRIBUTING.md)
|
|
32
|
+
[](CODE_OF_CONDUCT.md)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# Supported platforms
|
|
40
|
+
|
|
41
|
+
The `ziti-sdk-nodejs` module works with Node.js v11.x, v12.x, v13.x, v14.x
|
|
42
|
+
|
|
43
|
+
Binaries for most Node versions and platforms are provided by default via [node-pre-gyp](https://github.com/mapbox/node-pre-gyp).
|
|
44
|
+
|
|
45
|
+
# Installing
|
|
46
|
+
|
|
47
|
+
``` js
|
|
48
|
+
npm i @openziti/ziti-sdk-nodejs
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# Usage
|
|
53
|
+
|
|
54
|
+
**Note:** the module must be [installed](#installing) before use.
|
|
55
|
+
|
|
56
|
+
``` js
|
|
57
|
+
var ziti = require('ziti-sdk-nodejs');
|
|
58
|
+
|
|
59
|
+
const ziti_init = async (identity) => {
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
ziti.ziti_init(identity, () => {
|
|
62
|
+
resolve();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const ziti_service_available = (service) => {
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
ziti.ziti_service_available(service, (status) => {
|
|
70
|
+
resolve(status);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
function ziti_dial(service) {
|
|
76
|
+
return new Promise((resolve, reject) => {
|
|
77
|
+
ziti.ziti_dial(
|
|
78
|
+
service,
|
|
79
|
+
(conn) => {
|
|
80
|
+
resolve(conn);
|
|
81
|
+
},
|
|
82
|
+
(data) => {
|
|
83
|
+
// Do something with data...
|
|
84
|
+
},
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const ziti_write = (conn, data) => {
|
|
90
|
+
return new Promise((resolve) => {
|
|
91
|
+
ziti.ziti_write(conn, data, () => {
|
|
92
|
+
resolve();
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
(async () => {
|
|
98
|
+
|
|
99
|
+
await ziti_init(LOCATION_OF_IDENTITY_FILE);
|
|
100
|
+
|
|
101
|
+
let status = await ziti_service_available(YOUR_SERVICE_NAME);
|
|
102
|
+
|
|
103
|
+
if (status === 0) {
|
|
104
|
+
|
|
105
|
+
const conn = await ziti_dial(YOUR_SERVICE_NAME);
|
|
106
|
+
|
|
107
|
+
let data = SOME_KIND_OF_DATA;
|
|
108
|
+
|
|
109
|
+
let buffer = Buffer.from(data);
|
|
110
|
+
|
|
111
|
+
await ziti_write(conn, buffer);
|
|
112
|
+
|
|
113
|
+
...etc
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
})();
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
# Ziti NodeJS SDK - Setup for Development
|
|
121
|
+
|
|
122
|
+
The following steps should get your NodeJS SDK for Ziti building. The Ziti NodeJS SDK is a native addon for Node JS,
|
|
123
|
+
and is written in C. C development is specific to your operating system and tool chain used. These steps should work
|
|
124
|
+
properly for you but if your OS has variations you may need to adapt these steps accordingly.
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
## Prerequisites
|
|
128
|
+
|
|
129
|
+
### Build
|
|
130
|
+
|
|
131
|
+
* [Cmake (3.12+)](https://cmake.org/install/)
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
## Build
|
|
135
|
+
|
|
136
|
+
### Linux/MacOS
|
|
137
|
+
|
|
138
|
+
Building the NodeJS SDK on linux/mac can be accomplished with:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
$ npm run build
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
Getting Help
|
|
146
|
+
------------
|
|
147
|
+
Please use these community resources for getting help. We use GitHub [issues](https://github.com/NetFoundry/ziti-sdk-nodejs/issues)
|
|
148
|
+
for tracking bugs and feature requests and have limited bandwidth to address them.
|
|
149
|
+
|
|
150
|
+
- Read the [docs](https://netfoundry.github.io/ziti-doc/ziti/overview.html)
|
|
151
|
+
- Join our [Developer Community](https://developer.netfoundry.io)
|
|
152
|
+
- Participate in discussion on [Discourse](https://openziti.discourse.group/)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
Copyright© NetFoundry, Inc.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
platform:
|
|
2
|
+
- x64
|
|
3
|
+
|
|
4
|
+
configuration:
|
|
5
|
+
- Debug
|
|
6
|
+
|
|
7
|
+
image:
|
|
8
|
+
- Visual Studio 2019
|
|
9
|
+
|
|
10
|
+
environment:
|
|
11
|
+
AWS_ACCESS_KEY_ID:
|
|
12
|
+
secure: GIQzwkV21ZqWhzZ0ii13r4dOEZ6Pkq8r6Jajx18uEaY=
|
|
13
|
+
AWS_SECRET_ACCESS_KEY:
|
|
14
|
+
secure: 7sxn6236C/oltJYJfel3ISUxQfuBfB44QqdWs0Thjy+U3s+6MPugW8CGVlC8p0o8
|
|
15
|
+
|
|
16
|
+
matrix:
|
|
17
|
+
- nodejs_version: 11
|
|
18
|
+
platform: x64
|
|
19
|
+
- nodejs_version: 12
|
|
20
|
+
platform: x64
|
|
21
|
+
- nodejs_version: 13
|
|
22
|
+
platform: x64
|
|
23
|
+
- nodejs_version: 14
|
|
24
|
+
platform: x64
|
|
25
|
+
|
|
26
|
+
install:
|
|
27
|
+
- scripts\build-appveyor.bat
|
|
28
|
+
- ps: if($env:appveyor_repo_tag -eq 'True') { npm run publish } else { echo "Not publishing binary because this is not a tag build" }
|
|
29
|
+
|
|
30
|
+
build: OFF
|
|
31
|
+
test: OFF
|
|
32
|
+
deploy: OFF
|
package/binding.gyp
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
{
|
|
2
|
+
# "includes": [ "deps/common-ziti.gypi" ],
|
|
3
|
+
|
|
4
|
+
# The "cd" variable is passed in, and used, only during Windows builds
|
|
5
|
+
'variables': {
|
|
6
|
+
'cd%': '.',
|
|
7
|
+
|
|
8
|
+
# node v0.6.x doesn't give us its build variables,
|
|
9
|
+
# but on Unix it was only possible to use the system OpenSSL library,
|
|
10
|
+
# so default the variable to "true", v0.8.x node and up will overwrite it.
|
|
11
|
+
'node_shared_openssl%': 'true'
|
|
12
|
+
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
"targets": [
|
|
16
|
+
{
|
|
17
|
+
'defines': [
|
|
18
|
+
'BUILD_DATE=<@(BUILD_DATE)',
|
|
19
|
+
'ZITI_BRANCH=<@(ZITI_BRANCH)',
|
|
20
|
+
'ZITI_COMMIT=<@(ZITI_COMMIT)',
|
|
21
|
+
'ZITI_VERSION=<@(ZITI_VERSION)',
|
|
22
|
+
'ZITI_OS=<@(ZITI_OS)',
|
|
23
|
+
'ZITI_ARCH=<@(ZITI_ARCH)',
|
|
24
|
+
],
|
|
25
|
+
|
|
26
|
+
"target_name": "<(module_name)",
|
|
27
|
+
|
|
28
|
+
"product_dir": "<(module_path)",
|
|
29
|
+
|
|
30
|
+
"sources": [
|
|
31
|
+
"./src/ziti-add-on.c",
|
|
32
|
+
"./src/ziti_close.c",
|
|
33
|
+
"./src/ziti_dial.c",
|
|
34
|
+
"./src/ziti_enroll.c",
|
|
35
|
+
"./src/ziti_hello.c",
|
|
36
|
+
"./src/Ziti_https_request.c",
|
|
37
|
+
"./src/Ziti_https_request_data.c",
|
|
38
|
+
"./src/Ziti_https_request_end.c",
|
|
39
|
+
"./src/ziti_init.c",
|
|
40
|
+
"./src/ziti_service_available.c",
|
|
41
|
+
"./src/ziti_shutdown.c",
|
|
42
|
+
"./src/ziti_write.c",
|
|
43
|
+
"./src/ziti_websocket_connect.c",
|
|
44
|
+
"./src/ziti_websocket_write.c",
|
|
45
|
+
# "./src/stack_traces.c",
|
|
46
|
+
"./src/utils.c",
|
|
47
|
+
],
|
|
48
|
+
|
|
49
|
+
"include_dirs": [
|
|
50
|
+
"deps/ziti-sdk-c/includes",
|
|
51
|
+
"deps/ziti-sdk-c/build/_deps/uv-mbed-src/include",
|
|
52
|
+
"deps/ziti-sdk-c/build/_deps/http_parser-src",
|
|
53
|
+
"deps/ziti-sdk-c/build/_deps/uv_link-src/include",
|
|
54
|
+
],
|
|
55
|
+
|
|
56
|
+
"conditions": [
|
|
57
|
+
|
|
58
|
+
['node_shared_openssl=="false"', {
|
|
59
|
+
# so when "node_shared_openssl" is "false", then OpenSSL has been
|
|
60
|
+
# bundled into the node executable. So we need to include the same
|
|
61
|
+
# header files that were used when building node.
|
|
62
|
+
'include_dirs': [
|
|
63
|
+
'<(node_root_dir)/deps/openssl/openssl/include'
|
|
64
|
+
],
|
|
65
|
+
"conditions" : [
|
|
66
|
+
["target_arch=='ia32'", {
|
|
67
|
+
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/piii" ]
|
|
68
|
+
}],
|
|
69
|
+
["target_arch=='x64'", {
|
|
70
|
+
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/k8" ]
|
|
71
|
+
}],
|
|
72
|
+
["target_arch=='arm'", {
|
|
73
|
+
"include_dirs": [ "<(node_root_dir)/deps/openssl/config/arm" ]
|
|
74
|
+
}]
|
|
75
|
+
]
|
|
76
|
+
}],
|
|
77
|
+
|
|
78
|
+
["OS=='mac'", {
|
|
79
|
+
|
|
80
|
+
"libraries": [
|
|
81
|
+
"$(PWD)/deps/ziti-sdk-c/build/_deps/libuv-build/libuv_a.a",
|
|
82
|
+
"$(PWD)/deps/ziti-sdk-c/build/_deps/libsodium-build/lib/libsodium.a",
|
|
83
|
+
"$(PWD)/deps/ziti-sdk-c/build/_deps/uv-mbed-build/libuv_mbed.a",
|
|
84
|
+
"$(PWD)/deps/ziti-sdk-c/build/library/libziti.a",
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# These are used when a local Xcode debug build is in play
|
|
88
|
+
# "$(PWD)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/Debug/libhttp-parser.a",
|
|
89
|
+
# "$(PWD)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/mbedtls/crypto/library/Debug/libmbedcrypto.a",
|
|
90
|
+
# "$(PWD)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/mbedtls/library/Debug/libmbedtls.a",
|
|
91
|
+
# "$(PWD)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/mbedtls/library/Debug/libmbedx509.a",
|
|
92
|
+
# "$(PWD)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/libuv/Debug/libuv_a.a",
|
|
93
|
+
# "$(PWD)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/Debug/libuv_link.a",
|
|
94
|
+
# "$(PWD)/deps/ziti-sdk-c/build/deps/uv-mbed/Debug/libuv_mbed.a",
|
|
95
|
+
# "$(PWD)/deps/ziti-sdk-c/build/library/Debug/libziti.a",
|
|
96
|
+
|
|
97
|
+
],
|
|
98
|
+
|
|
99
|
+
"xcode_settings": {
|
|
100
|
+
"ALWAYS_SEARCH_USER_PATHS": "NO",
|
|
101
|
+
"GCC_CW_ASM_SYNTAX": "NO", # No -fasm-blocks
|
|
102
|
+
"GCC_DYNAMIC_NO_PIC": "NO", # No -mdynamic-no-pic
|
|
103
|
+
# (Equivalent to -fPIC)
|
|
104
|
+
"GCC_ENABLE_CPP_EXCEPTIONS": "NO", # -fno-exceptions
|
|
105
|
+
"GCC_ENABLE_CPP_RTTI": "NO", # -fno-rtti
|
|
106
|
+
"GCC_ENABLE_PASCAL_STRINGS": "NO", # No -mpascal-strings
|
|
107
|
+
"GCC_THREADSAFE_STATICS": "NO", # -fno-threadsafe-statics
|
|
108
|
+
"PREBINDING": "NO", # No -Wl,-prebind
|
|
109
|
+
"MACOSX_DEPLOYMENT_TARGET": "10.15", # -mmacosx-version-min=10.14
|
|
110
|
+
"USE_HEADERMAP": "NO",
|
|
111
|
+
"OTHER_CFLAGS": [
|
|
112
|
+
"-fno-strict-aliasing",
|
|
113
|
+
"-g",
|
|
114
|
+
"-fno-pie",
|
|
115
|
+
"-DSOURCE_PATH_SIZE=3"
|
|
116
|
+
],
|
|
117
|
+
"OTHER_LDFLAGS": [
|
|
118
|
+
"-g",
|
|
119
|
+
"-mmacosx-version-min=10.15",
|
|
120
|
+
],
|
|
121
|
+
"WARNING_CFLAGS": [
|
|
122
|
+
"-Wall",
|
|
123
|
+
"-Wendif-labels",
|
|
124
|
+
"-W",
|
|
125
|
+
"-Wno-unused-parameter",
|
|
126
|
+
"-Wno-pointer-sign",
|
|
127
|
+
"-Wno-unused-function",
|
|
128
|
+
],
|
|
129
|
+
}
|
|
130
|
+
}],
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
['OS == "win"', {
|
|
134
|
+
|
|
135
|
+
'defines': [
|
|
136
|
+
'WIN32',
|
|
137
|
+
# we don't really want VC++ warning us about
|
|
138
|
+
# how dangerous C functions are...
|
|
139
|
+
'_CRT_SECURE_NO_DEPRECATE',
|
|
140
|
+
# ... or that C implementations shouldn't use
|
|
141
|
+
# POSIX names
|
|
142
|
+
'_CRT_NONSTDC_NO_DEPRECATE',
|
|
143
|
+
#
|
|
144
|
+
'NOGDI',
|
|
145
|
+
'DSOURCE_PATH_SIZE=3'
|
|
146
|
+
],
|
|
147
|
+
|
|
148
|
+
"include_dirs": [
|
|
149
|
+
"deps/ziti-sdk-c/includes",
|
|
150
|
+
"deps/ziti-sdk-c/deps/uv-mbed/include"
|
|
151
|
+
],
|
|
152
|
+
"libraries": [
|
|
153
|
+
# "<(cd)/deps/ziti-sdk-c/build/_deps/mbedtls-build/library/mbedcrypto.lib",
|
|
154
|
+
# "<(cd)/deps/ziti-sdk-c/build/_deps/mbedtls-build/library/mbedtls.lib",
|
|
155
|
+
# "<(cd)/deps/ziti-sdk-c/build/_deps/mbedtls-build/library/mbedx509.lib",
|
|
156
|
+
"<(cd)/deps/ziti-sdk-c/build/_deps/libuv-build/uv_a.lib",
|
|
157
|
+
"<(cd)/deps/ziti-sdk-c/build/_deps/libsodium-src/x64/Release/v142/static/libsodium.lib",
|
|
158
|
+
"<(cd)/deps/ziti-sdk-c/build/_deps/uv-mbed-build/uv_mbed.lib",
|
|
159
|
+
"<(cd)/deps/ziti-sdk-c/build/library/ziti.lib",
|
|
160
|
+
|
|
161
|
+
# "<(cd)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/http-parser.lib",
|
|
162
|
+
# "<(cd)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/mbedtls/crypto/library/mbedcrypto.lib",
|
|
163
|
+
# "<(cd)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/mbedtls/library/mbedtls.lib",
|
|
164
|
+
# "<(cd)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/mbedtls/library/mbedx509.lib",
|
|
165
|
+
# "<(cd)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/libuv/uv_a.lib",
|
|
166
|
+
# "<(cd)/deps/ziti-sdk-c/build/deps/uv-mbed/deps/uv_link.lib",
|
|
167
|
+
# "<(cd)/deps/ziti-sdk-c/build/deps/uv-mbed/uv_mbed.lib",
|
|
168
|
+
# "<(cd)/deps/ziti-sdk-c/build/library/ziti.lib",
|
|
169
|
+
# "<(cd)/deps/ziti-sdk-c/build/_deps/libsodium-src/x64/Release/v142/static/libsodium.lib",
|
|
170
|
+
"-lws2_32.lib",
|
|
171
|
+
"-lIphlpapi.lib",
|
|
172
|
+
"-lpsapi",
|
|
173
|
+
"-luserenv.lib"
|
|
174
|
+
],
|
|
175
|
+
|
|
176
|
+
'msvs_settings': {
|
|
177
|
+
'VCCLCompilerTool': {
|
|
178
|
+
'RuntimeLibrary': 1, # static debug
|
|
179
|
+
'Optimization': 0, # /Od, no optimization
|
|
180
|
+
},
|
|
181
|
+
'VCLinkerTool': {
|
|
182
|
+
'AdditionalOptions': [
|
|
183
|
+
'/FORCE'
|
|
184
|
+
],
|
|
185
|
+
'LinkTimeCodeGeneration': 1, # link-time code generation
|
|
186
|
+
'GenerateDebugInformation': 'true',
|
|
187
|
+
'IgnoreDefaultLibraryNames': [
|
|
188
|
+
'libcmtd.lib', 'libcmt.lib', 'msvcrtd.lib'
|
|
189
|
+
],
|
|
190
|
+
'SubSystem': 1, # /subsystem:console
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
}],
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
['OS == "linux"', {
|
|
198
|
+
|
|
199
|
+
"libraries": [
|
|
200
|
+
"<(module_root_dir)/deps/ziti-sdk-c/build/library/libziti.a",
|
|
201
|
+
"<(module_root_dir)/deps/ziti-sdk-c/build/_deps/libuv-build/libuv_a.a",
|
|
202
|
+
"<(module_root_dir)/deps/ziti-sdk-c/build/_deps/uv-mbed-build/libuv_mbed.a",
|
|
203
|
+
"<(module_root_dir)/deps/ziti-sdk-c/build/_deps/libsodium-build/lib/libsodium.a",
|
|
204
|
+
],
|
|
205
|
+
|
|
206
|
+
"link_settings": {
|
|
207
|
+
"ldflags": [
|
|
208
|
+
"-v",
|
|
209
|
+
"-g",
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
|
|
213
|
+
"cflags": [
|
|
214
|
+
"-fno-strict-aliasing",
|
|
215
|
+
"-g",
|
|
216
|
+
"-fno-pie",
|
|
217
|
+
"-fPIC",
|
|
218
|
+
"-DSOURCE_PATH_SIZE=3"
|
|
219
|
+
]
|
|
220
|
+
|
|
221
|
+
}]
|
|
222
|
+
|
|
223
|
+
]
|
|
224
|
+
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
}
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2019-2020 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
|
+
module.exports = require('./ziti');
|
package/lib/ziti.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2019-2020 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
|
+
var binding;
|
|
18
|
+
|
|
19
|
+
function importAll (r) {
|
|
20
|
+
r.keys().forEach(key => {
|
|
21
|
+
console.log('importAll() addon key is: ', key);
|
|
22
|
+
binding = r(key); // Load the addon
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (typeof require.context == 'function') {
|
|
27
|
+
|
|
28
|
+
importAll( require.context("../build/", true, /\.node$/) );
|
|
29
|
+
|
|
30
|
+
} else {
|
|
31
|
+
|
|
32
|
+
const binary = require('@mapbox/node-pre-gyp');
|
|
33
|
+
const path = require('path')
|
|
34
|
+
const binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')), {debug: false});
|
|
35
|
+
|
|
36
|
+
binding = require(binding_path);
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var ziti = module.exports = exports = binding;
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openziti/ziti-sdk-nodejs",
|
|
3
|
+
"description": "A NodeJS-based SDK for delivering secure applications over a Ziti Network",
|
|
4
|
+
"version": "0.6.0",
|
|
5
|
+
"main": "./lib/ziti",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "npm run build:init; npm run build:c-sdk; npm install --build-from-source --clang=1",
|
|
8
|
+
"build:init": "git submodule update --init --recursive",
|
|
9
|
+
"build:c-sdk": "cd deps/ziti-sdk-c; git submodule update --init --recursive; mkdir build; cd build; cmake -G Ninja -DCMAKE_POSITION_INDEPENDENT_CODE=ON --config Debug ..; cmake --build . --target all",
|
|
10
|
+
"build:nodejs": "node-gyp clean configure --debug build --debug -g --mmacosx-version-min=10.13",
|
|
11
|
+
"build:nodejsdbg": "npm install --build-from-source --debug -g",
|
|
12
|
+
"build:cleanup": "cd deps/ziti-sdk-c && rm -rf build",
|
|
13
|
+
"clean": "node-gyp clean; rm -rf build; cd deps/ziti-sdk-c && rm -rf build",
|
|
14
|
+
"test": "echo \"Error: no test specified\"",
|
|
15
|
+
"configure": "node-gyp configure --debug",
|
|
16
|
+
"start": "node main.js ./config/identity.json chapel-hill",
|
|
17
|
+
"install": "node-pre-gyp install --fallback-to-build",
|
|
18
|
+
"install-dbg": "npm install --build-from-source --clang=1 --debug",
|
|
19
|
+
"publish": "node-pre-gyp package publish"
|
|
20
|
+
},
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/netfoundry/ziti-sdk-nodejs.git"
|
|
24
|
+
},
|
|
25
|
+
"binary": {
|
|
26
|
+
"module_name": "ziti_sdk_nodejs",
|
|
27
|
+
"module_path": "./build/{configuration}/{node_abi}-{platform}-{arch}/",
|
|
28
|
+
"remote_path": "./{module_name}/v{version}/{configuration}/",
|
|
29
|
+
"package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz",
|
|
30
|
+
"host": "https://ziti-npm.s3.amazonaws.com"
|
|
31
|
+
},
|
|
32
|
+
"license": "Apache-2.0",
|
|
33
|
+
"licenses": [
|
|
34
|
+
{
|
|
35
|
+
"type": "Apache-2.0",
|
|
36
|
+
"url": "http://www.apache.org/licenses/LICENSE-2.0"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"keywords": [
|
|
40
|
+
"ziti",
|
|
41
|
+
"nodejs"
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=11.0.0"
|
|
45
|
+
},
|
|
46
|
+
"author": {
|
|
47
|
+
"name": "NetFoundry",
|
|
48
|
+
"url": "http://netfoundry.io"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"aws-sdk": "^2.823.0"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@mapbox/node-pre-gyp": "^1.0.8"
|
|
55
|
+
}
|
|
56
|
+
}
|