@ngrok/ngrok 0.1.1 → 0.3.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/.prettierrc.json +3 -0
- package/CHANGELOG.md +10 -0
- package/Cargo.toml +1 -1
- package/README.md +51 -10
- package/RELEASE.md +3 -3
- package/docs/assets/highlight.css +13 -6
- package/docs/assets/main.js +3 -3
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +447 -362
- package/docs/classes/NgrokHttpTunnel.html +112 -77
- package/docs/classes/NgrokHttpTunnelBuilder.html +235 -199
- package/docs/classes/NgrokLabeledTunnel.html +107 -72
- package/docs/classes/NgrokLabeledTunnelBuilder.html +84 -49
- package/docs/classes/NgrokSession.html +99 -66
- package/docs/classes/NgrokSessionBuilder.html +171 -138
- package/docs/classes/NgrokTcpTunnel.html +112 -77
- package/docs/classes/NgrokTcpTunnelBuilder.html +115 -80
- package/docs/classes/NgrokTlsTunnel.html +112 -77
- package/docs/classes/NgrokTlsTunnelBuilder.html +133 -98
- package/docs/classes/UpdateRequest.html +69 -33
- package/docs/functions/authtoken.html +88 -0
- package/docs/functions/connect.html +88 -0
- package/docs/functions/consoleLog.html +50 -34
- package/docs/functions/disconnect.html +88 -0
- package/docs/functions/kill.html +83 -0
- package/docs/functions/listen.html +52 -36
- package/docs/functions/listenable.html +51 -35
- package/docs/functions/loggingCallback.html +56 -40
- package/docs/index.html +115 -84
- package/docs/interfaces/Config.html +608 -0
- package/docs/modules.html +74 -47
- package/examples/express/ngrok-express-quickstart.js +11 -0
- package/examples/express/ngrok-express.js +28 -0
- package/examples/express/package.json +7 -0
- package/examples/fastify/ngrok-fastify.js +26 -0
- package/examples/fastify/package.json +7 -0
- package/examples/hapi/ngrok-hapi.js +35 -0
- package/examples/hapi/package.json +7 -0
- package/examples/koa/ngrok-koa.js +12 -0
- package/examples/koa/package.json +7 -0
- package/examples/nestjs/.eslintrc.js +25 -0
- package/examples/nestjs/.prettierrc +4 -0
- package/examples/nestjs/README.md +73 -0
- package/examples/nestjs/nest-cli.json +8 -0
- package/examples/nestjs/package-lock.json +12138 -0
- package/examples/nestjs/package.json +70 -0
- package/examples/nestjs/src/app.controller.spec.ts +22 -0
- package/examples/nestjs/src/app.controller.ts +12 -0
- package/examples/nestjs/src/app.module.ts +10 -0
- package/examples/nestjs/src/app.service.ts +8 -0
- package/examples/nestjs/src/main.ts +17 -0
- package/examples/nestjs/test/app.e2e-spec.ts +24 -0
- package/examples/nestjs/test/jest-e2e.json +9 -0
- package/examples/nestjs/tsconfig.build.json +4 -0
- package/examples/nestjs/tsconfig.json +21 -0
- package/examples/nextjs/next.config.js +12 -0
- package/examples/nextjs/ngrok.config.js +23 -0
- package/examples/nextjs/package.json +6 -0
- package/examples/nextjs/pages/index.js +5 -0
- package/examples/ngrok-connect-full.js +64 -0
- package/examples/ngrok-connect-minimal.js +16 -0
- package/examples/ngrok-http-full.js +28 -22
- package/examples/ngrok-http-minimum.js +17 -13
- package/examples/ngrok-labeled.js +22 -18
- package/examples/ngrok-listen.js +6 -7
- package/examples/ngrok-tcp.js +22 -19
- package/examples/ngrok-tls.js +23 -20
- package/examples/ngrok-typescript.ts +32 -27
- package/examples/ngrok-windows-pipe.js +22 -14
- package/examples/ngrok-winston.js +9 -9
- package/examples/package.json +11 -0
- package/examples/remix/.eslintrc.js +4 -0
- package/examples/remix/README.md +53 -0
- package/examples/remix/app/entry.client.tsx +18 -0
- package/examples/remix/app/entry.server.tsx +101 -0
- package/examples/remix/app/root.tsx +20 -0
- package/examples/remix/app/routes/_index.tsx +30 -0
- package/examples/remix/ngrok.config.js +16 -0
- package/examples/remix/package.json +30 -0
- package/examples/remix/public/favicon.ico +0 -0
- package/examples/remix/remix.config.js +16 -0
- package/examples/remix/remix.env.d.ts +2 -0
- package/examples/remix/tsconfig.json +22 -0
- package/examples/svelte/README.md +38 -0
- package/examples/svelte/jsconfig.json +17 -0
- package/examples/svelte/ngrok.config.cjs +18 -0
- package/examples/svelte/package.json +22 -0
- package/examples/svelte/src/app.d.ts +12 -0
- package/examples/svelte/src/app.html +12 -0
- package/examples/svelte/src/routes/+page.svelte +2 -0
- package/examples/svelte/static/favicon.png +0 -0
- package/examples/svelte/svelte.config.js +14 -0
- package/examples/svelte/vite.config.js +6 -0
- package/examples/vue/.vscode/extensions.json +3 -0
- package/examples/vue/README.md +40 -0
- package/examples/vue/env.d.ts +1 -0
- package/examples/vue/index.html +13 -0
- package/examples/vue/ngrok.config.ts +18 -0
- package/examples/vue/package.json +25 -0
- package/examples/vue/public/favicon.ico +0 -0
- package/examples/vue/src/App.vue +47 -0
- package/examples/vue/src/assets/base.css +74 -0
- package/examples/vue/src/assets/logo.svg +1 -0
- package/examples/vue/src/assets/main.css +35 -0
- package/examples/vue/src/components/HelloWorld.vue +40 -0
- package/examples/vue/src/components/TheWelcome.vue +86 -0
- package/examples/vue/src/components/WelcomeItem.vue +86 -0
- package/examples/vue/src/components/icons/IconCommunity.vue +7 -0
- package/examples/vue/src/components/icons/IconDocumentation.vue +7 -0
- package/examples/vue/src/components/icons/IconEcosystem.vue +7 -0
- package/examples/vue/src/components/icons/IconSupport.vue +7 -0
- package/examples/vue/src/components/icons/IconTooling.vue +19 -0
- package/examples/vue/src/main.ts +6 -0
- package/examples/vue/tsconfig.json +16 -0
- package/examples/vue/tsconfig.node.json +8 -0
- package/examples/vue/vite.config.ts +15 -0
- package/flake.nix +1 -1
- package/index.d.ts +243 -19
- package/index.js +145 -29
- package/package.json +20 -21
- package/post-build.js +18 -11
- package/scripts/gc-node-drop.js +38 -31
- package/scripts/gc-rust-drop.js +44 -38
- package/src/config.rs +182 -0
- package/src/connect.rs +328 -0
- package/src/http.rs +5 -4
- package/src/lib.rs +2 -0
- package/src/session.rs +61 -4
- package/src/tls.rs +1 -1
- package/src/tunnel.rs +105 -37
- package/src/tunnel_builder.rs +8 -0
- package/trailer.d.ts +9 -4
- package/trailer.js +140 -28
- package/examples/ngrok-express-quickstart.js +0 -11
- package/examples/ngrok-express.js +0 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrok/ngrok",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"napi": {
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"aarch64-linux-android",
|
|
12
12
|
"aarch64-unknown-linux-gnu",
|
|
13
13
|
"aarch64-unknown-linux-musl",
|
|
14
|
-
"aarch64-pc-windows-msvc",
|
|
15
14
|
"armv7-unknown-linux-gnueabihf",
|
|
16
15
|
"x86_64-unknown-linux-musl",
|
|
17
16
|
"x86_64-unknown-freebsd",
|
|
@@ -21,6 +20,7 @@
|
|
|
21
20
|
]
|
|
22
21
|
}
|
|
23
22
|
},
|
|
23
|
+
"unused-for-now": "aarch64-pc-windows-msvc",
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@napi-rs/cli": "^2.15.1",
|
|
@@ -28,10 +28,9 @@
|
|
|
28
28
|
"ava": "^4.3.3",
|
|
29
29
|
"axios": "^1.3.3",
|
|
30
30
|
"express": "^4.18.2",
|
|
31
|
-
"
|
|
32
|
-
"typedoc": "^0.
|
|
33
|
-
"typescript": "^4.9.5"
|
|
34
|
-
"winston": "^3.8.2"
|
|
31
|
+
"prettier": "^2.8.7",
|
|
32
|
+
"typedoc": "^0.24.6",
|
|
33
|
+
"typescript": "^4.9.5"
|
|
35
34
|
},
|
|
36
35
|
"ava": {
|
|
37
36
|
"timeout": "3m"
|
|
@@ -44,8 +43,9 @@
|
|
|
44
43
|
"build": "napi build --platform --release --js gen.js --dts gen.d.ts --pipe 'node post-build.js trailer index'",
|
|
45
44
|
"build:debug": "napi build --platform",
|
|
46
45
|
"clean": "rm -rf node_modules/ target/",
|
|
47
|
-
"docs": "mv trailer.d.ts trailer.d.hidden; npx typedoc index.d.ts; mv trailer.d.hidden trailer.d.ts",
|
|
46
|
+
"docs": "mv trailer.d.ts trailer.d.hidden; mv examples .examples; npx typedoc index.d.ts --navigation.includeGroups; mv .examples examples; mv trailer.d.hidden trailer.d.ts",
|
|
48
47
|
"prepublishOnly": "napi prepublish -t npm",
|
|
48
|
+
"prettier": "prettier --write .",
|
|
49
49
|
"test": "ava",
|
|
50
50
|
"universal": "napi universal",
|
|
51
51
|
"version": "napi version"
|
|
@@ -54,19 +54,18 @@
|
|
|
54
54
|
"description": "The ngrok agent in library form, suitable for integrating directly into your NodeJS application.",
|
|
55
55
|
"repository": "https://github.com/ngrok/ngrok-js",
|
|
56
56
|
"optionalDependencies": {
|
|
57
|
-
"@ngrok/ngrok-win32-x64-msvc": "0.
|
|
58
|
-
"@ngrok/ngrok-darwin-x64": "0.
|
|
59
|
-
"@ngrok/ngrok-linux-x64-gnu": "0.
|
|
60
|
-
"@ngrok/ngrok-darwin-arm64": "0.
|
|
61
|
-
"@ngrok/ngrok-android-arm64": "0.
|
|
62
|
-
"@ngrok/ngrok-linux-arm64-gnu": "0.
|
|
63
|
-
"@ngrok/ngrok-linux-arm64-musl": "0.
|
|
64
|
-
"@ngrok/ngrok-
|
|
65
|
-
"@ngrok/ngrok-linux-
|
|
66
|
-
"@ngrok/ngrok-
|
|
67
|
-
"@ngrok/ngrok-
|
|
68
|
-
"@ngrok/ngrok-
|
|
69
|
-
"@ngrok/ngrok-
|
|
70
|
-
"@ngrok/ngrok-darwin-universal": "0.1.1"
|
|
57
|
+
"@ngrok/ngrok-win32-x64-msvc": "0.3.0",
|
|
58
|
+
"@ngrok/ngrok-darwin-x64": "0.3.0",
|
|
59
|
+
"@ngrok/ngrok-linux-x64-gnu": "0.3.0",
|
|
60
|
+
"@ngrok/ngrok-darwin-arm64": "0.3.0",
|
|
61
|
+
"@ngrok/ngrok-android-arm64": "0.3.0",
|
|
62
|
+
"@ngrok/ngrok-linux-arm64-gnu": "0.3.0",
|
|
63
|
+
"@ngrok/ngrok-linux-arm64-musl": "0.3.0",
|
|
64
|
+
"@ngrok/ngrok-linux-arm-gnueabihf": "0.3.0",
|
|
65
|
+
"@ngrok/ngrok-linux-x64-musl": "0.3.0",
|
|
66
|
+
"@ngrok/ngrok-freebsd-x64": "0.3.0",
|
|
67
|
+
"@ngrok/ngrok-win32-ia32-msvc": "0.3.0",
|
|
68
|
+
"@ngrok/ngrok-android-arm-eabi": "0.3.0",
|
|
69
|
+
"@ngrok/ngrok-darwin-universal": "0.3.0"
|
|
71
70
|
}
|
|
72
71
|
}
|
package/post-build.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// basically "cat gen.js trailer.js > index.js" but in nodejs to be cross-platform
|
|
2
2
|
// called from 'yarn build', configured in package.json
|
|
3
|
-
// e.g.: node post-build.js trailer index <input_file_path>
|
|
3
|
+
// e.g.: node post-build.js trailer index <input_file_path>
|
|
4
4
|
|
|
5
5
|
var args = process.argv.slice(2);
|
|
6
6
|
var trailer_prefix = args[0];
|
|
@@ -9,7 +9,7 @@ var input_path = args[2];
|
|
|
9
9
|
|
|
10
10
|
// skipping the typescript file since it actually isn't written before the call to pipe:
|
|
11
11
|
// https://github.com/napi-rs/napi-rs/issues/1188
|
|
12
|
-
if (input_path.endsWith(
|
|
12
|
+
if (input_path.endsWith(".d.ts")) {
|
|
13
13
|
console.log("skipping .d.ts file: " + input_path);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
@@ -18,21 +18,28 @@ if (input_path.endsWith('.d.ts')) {
|
|
|
18
18
|
concat_files(trailer_prefix, output_prefix, input_path);
|
|
19
19
|
concat_files(trailer_prefix, output_prefix, input_path.replace(/\.js/, ".d.ts"));
|
|
20
20
|
|
|
21
|
-
function concat_files
|
|
22
|
-
console.log(
|
|
23
|
-
|
|
21
|
+
function concat_files(trailer_prefix, output_prefix, input_path) {
|
|
22
|
+
console.log(
|
|
23
|
+
"trailer_prefix: '" +
|
|
24
|
+
trailer_prefix +
|
|
25
|
+
"' output_prefix: '" +
|
|
26
|
+
output_prefix +
|
|
27
|
+
"' input_path: '" +
|
|
28
|
+
input_path +
|
|
29
|
+
"'"
|
|
30
|
+
);
|
|
24
31
|
path = require("path");
|
|
25
32
|
input_filename = path.basename(input_path);
|
|
26
|
-
input_suffix = input_filename.substring(input_filename.indexOf(
|
|
33
|
+
input_suffix = input_filename.substring(input_filename.indexOf("."), input_filename.length);
|
|
27
34
|
output_filename = output_prefix + input_suffix;
|
|
28
35
|
|
|
29
36
|
console.log("writing: " + output_filename);
|
|
30
|
-
var fs = require(
|
|
37
|
+
var fs = require("fs");
|
|
31
38
|
// input to output
|
|
32
|
-
var data = fs.readFileSync(input_path,
|
|
33
|
-
fs.writeFileSync(output_filename, data, {encoding:
|
|
39
|
+
var data = fs.readFileSync(input_path, "utf8");
|
|
40
|
+
fs.writeFileSync(output_filename, data, { encoding: "utf8", flag: "w" });
|
|
34
41
|
// trailer to output
|
|
35
|
-
data = fs.readFileSync(trailer_prefix + input_suffix,
|
|
36
|
-
fs.writeFileSync(output_filename, data, {encoding:
|
|
42
|
+
data = fs.readFileSync(trailer_prefix + input_suffix, "utf8");
|
|
43
|
+
fs.writeFileSync(output_filename, data, { encoding: "utf8", flag: "a" });
|
|
37
44
|
console.log("post-build complete");
|
|
38
45
|
}
|
package/scripts/gc-node-drop.js
CHANGED
|
@@ -1,42 +1,49 @@
|
|
|
1
1
|
// run with: node --trace-gc --expose-gc
|
|
2
|
-
if (typeof global.gc !==
|
|
2
|
+
if (typeof global.gc !== "function") {
|
|
3
3
|
console.log("must run with '--expose-gc'");
|
|
4
4
|
process.exit();
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
|
-
const SegfaultHandler = require(
|
|
8
|
-
SegfaultHandler.registerHandler(
|
|
7
|
+
const SegfaultHandler = require("../node_modules/segfault-handler");
|
|
8
|
+
SegfaultHandler.registerHandler("crash.log");
|
|
9
9
|
|
|
10
|
-
const http = require(
|
|
11
|
-
http
|
|
12
|
-
function(req,res){
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const http = require("http");
|
|
11
|
+
http
|
|
12
|
+
.createServer(function (req, res) {
|
|
13
|
+
res.writeHead(200);
|
|
14
|
+
res.write("Hello");
|
|
15
|
+
res.end();
|
|
16
|
+
})
|
|
17
|
+
.listen(8081);
|
|
16
18
|
|
|
17
|
-
var ngrok = require(
|
|
19
|
+
var ngrok = require("..");
|
|
18
20
|
// turn on debug
|
|
19
21
|
ngrok.consoleLog();
|
|
20
22
|
|
|
21
|
-
new ngrok.NgrokSessionBuilder()
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
new ngrok.NgrokSessionBuilder()
|
|
24
|
+
.authtokenFromEnv()
|
|
25
|
+
.connect()
|
|
26
|
+
.then((session) => {
|
|
27
|
+
session
|
|
28
|
+
.httpEndpoint()
|
|
29
|
+
.listen()
|
|
30
|
+
.then((tunnel) => {
|
|
31
|
+
tunnel.forwardTcp("localhost:8081").await;
|
|
32
|
+
console.log("tunnel: " + tunnel.url() + " id: " + tunnel.id());
|
|
33
|
+
setTimeout(function () {
|
|
34
|
+
console.log("\n\n=====> running gc");
|
|
35
|
+
global.gc();
|
|
36
|
+
}, 2000);
|
|
29
37
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
setTimeout(function () {
|
|
39
|
+
console.log("\n\n=====> closing and nulling tunnel");
|
|
40
|
+
tunnel.close().await;
|
|
41
|
+
tunnel = null;
|
|
42
|
+
}, 4000);
|
|
35
43
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
});
|
|
42
|
-
}).await;
|
|
44
|
+
setTimeout(function () {
|
|
45
|
+
console.log("\n\n=====> running gc");
|
|
46
|
+
global.gc();
|
|
47
|
+
}, 6000);
|
|
48
|
+
});
|
|
49
|
+
}).await;
|
package/scripts/gc-rust-drop.js
CHANGED
|
@@ -1,47 +1,53 @@
|
|
|
1
1
|
// run with: node --trace-gc --expose-gc
|
|
2
|
-
if (typeof global.gc !==
|
|
2
|
+
if (typeof global.gc !== "function") {
|
|
3
3
|
console.log("must run with '--expose-gc'");
|
|
4
4
|
process.exit();
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
6
|
|
|
7
|
-
const SegfaultHandler = require(
|
|
8
|
-
SegfaultHandler.registerHandler(
|
|
7
|
+
const SegfaultHandler = require("../node_modules/segfault-handler");
|
|
8
|
+
SegfaultHandler.registerHandler("crash.log");
|
|
9
9
|
|
|
10
|
-
const http = require(
|
|
11
|
-
http
|
|
12
|
-
function(req,res){
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const http = require("http");
|
|
11
|
+
http
|
|
12
|
+
.createServer(function (req, res) {
|
|
13
|
+
res.writeHead(200);
|
|
14
|
+
res.write("Hello");
|
|
15
|
+
res.end();
|
|
16
|
+
})
|
|
17
|
+
.listen(8081);
|
|
16
18
|
|
|
17
|
-
var ngrok = require(
|
|
19
|
+
var ngrok = require("..");
|
|
18
20
|
// turn on debug
|
|
19
21
|
ngrok.consoleLog();
|
|
20
22
|
|
|
21
|
-
new ngrok.NgrokSessionBuilder()
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
23
|
+
new ngrok.NgrokSessionBuilder()
|
|
24
|
+
.authtokenFromEnv()
|
|
25
|
+
.connect()
|
|
26
|
+
.then((session) => {
|
|
27
|
+
session
|
|
28
|
+
.httpEndpoint()
|
|
29
|
+
.listen()
|
|
30
|
+
.then((tunnel) => {
|
|
31
|
+
tunnel.forwardTcp("localhost:8081").await;
|
|
32
|
+
const tun_id = tunnel.id();
|
|
33
|
+
console.log("tunnel: " + tunnel.url() + " id: " + tun_id);
|
|
34
|
+
console.log("\n\n=====> nulling tunnel");
|
|
35
|
+
tunnel = null; // nodejs can gc
|
|
36
|
+
|
|
37
|
+
setTimeout(function () {
|
|
38
|
+
console.log("\n\n=====> running gc");
|
|
39
|
+
global.gc();
|
|
40
|
+
}, 2000);
|
|
41
|
+
|
|
42
|
+
setTimeout(function () {
|
|
43
|
+
console.log("\n\n=====> closing tunnel");
|
|
44
|
+
session.closeTunnel(tun_id).await;
|
|
45
|
+
}, 4000);
|
|
46
|
+
|
|
47
|
+
setTimeout(function () {
|
|
48
|
+
console.log("\n\n=====> nulling session, running gc");
|
|
49
|
+
session = null;
|
|
50
|
+
global.gc();
|
|
51
|
+
}, 6000);
|
|
52
|
+
});
|
|
53
|
+
}).await;
|
package/src/config.rs
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
use napi_derive::napi;
|
|
2
|
+
|
|
3
|
+
/// Configuration object to pass to ngrok.connect()
|
|
4
|
+
///
|
|
5
|
+
/// @group Functions
|
|
6
|
+
#[napi(object)]
|
|
7
|
+
#[derive(Default)]
|
|
8
|
+
pub struct Config {
|
|
9
|
+
/// Port, network address, or named pipe. Defaults to 80.
|
|
10
|
+
/// Examples: "80", "localhost:8080", "pipe:/tmp/my.sock"
|
|
11
|
+
#[napi(ts_type = "number|string")]
|
|
12
|
+
pub addr: Option<String>,
|
|
13
|
+
// Synonym for basic_auth
|
|
14
|
+
#[napi(ts_type = "string|Array<string>")]
|
|
15
|
+
pub auth: Option<Vec<String>>,
|
|
16
|
+
/// Configures the session to authenticate with the provided authtoken. You
|
|
17
|
+
/// can [find your existing authtoken] or [create a new one] in the ngrok
|
|
18
|
+
/// dashboard.
|
|
19
|
+
///
|
|
20
|
+
/// See the [authtoken parameter in the ngrok docs] for additional details.
|
|
21
|
+
///
|
|
22
|
+
/// [find your existing authtoken]: https://dashboard.ngrok.com/get-started/your-authtoken
|
|
23
|
+
/// [create a new one]: https://dashboard.ngrok.com/tunnels/authtokens
|
|
24
|
+
/// [authtoken parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#authtoken
|
|
25
|
+
pub authtoken: Option<String>,
|
|
26
|
+
/// Shortcut for calling [SessionBuilder::authtoken] with the value of the
|
|
27
|
+
/// NGROK_AUTHTOKEN environment variable.
|
|
28
|
+
#[napi(js_name = "authtoken_from_env")]
|
|
29
|
+
pub authtoken_from_env: Option<bool>,
|
|
30
|
+
/// Credentials for basic authentication, with username and password colon separated.
|
|
31
|
+
#[napi(js_name = "basic_auth", ts_type = "string|Array<string>")]
|
|
32
|
+
pub basic_auth: Option<Vec<String>>,
|
|
33
|
+
/// Unused, will warn and be ignored
|
|
34
|
+
pub bin_path: Option<String>,
|
|
35
|
+
/// Reject requests when 5XX responses exceed this ratio.
|
|
36
|
+
/// Disabled when 0.
|
|
37
|
+
#[napi(js_name = "circuit_breaker")]
|
|
38
|
+
pub circuit_breaker: Option<f64>,
|
|
39
|
+
/// Enable gzip compression for HTTP responses.
|
|
40
|
+
pub compression: Option<bool>,
|
|
41
|
+
/// Unused, will warn and be ignored
|
|
42
|
+
pub config_path: Option<String>,
|
|
43
|
+
/// The certificate to use for TLS termination at the ngrok edge in PEM format.
|
|
44
|
+
/// Only used if "proto" is "tls".
|
|
45
|
+
pub crt: Option<String>,
|
|
46
|
+
/// The domain to request for this edge.
|
|
47
|
+
pub domain: Option<String>,
|
|
48
|
+
/// Returns a human-readable string presented in the ngrok dashboard
|
|
49
|
+
/// and the Tunnels API.
|
|
50
|
+
#[napi(js_name = "forwards_to")]
|
|
51
|
+
pub forwards_to: Option<String>,
|
|
52
|
+
/// Unused, will warn and be ignored
|
|
53
|
+
#[napi(js_name = "host_header")]
|
|
54
|
+
pub host_header: Option<String>,
|
|
55
|
+
/// The hostname for the tunnel to forward to.
|
|
56
|
+
/// Only used if addr is not defined.
|
|
57
|
+
pub host: Option<String>,
|
|
58
|
+
/// Synonym for domain
|
|
59
|
+
pub hostname: Option<String>,
|
|
60
|
+
/// Unused, will warn and be ignored
|
|
61
|
+
pub inspect: Option<String>,
|
|
62
|
+
/// Restriction placed on the origin of incoming connections to the edge to only allow these CIDR ranges.
|
|
63
|
+
#[napi(
|
|
64
|
+
js_name = "ip_restriction_allow_cidrs",
|
|
65
|
+
ts_type = "string|Array<string>"
|
|
66
|
+
)]
|
|
67
|
+
pub allow_cidr: Option<Vec<String>>,
|
|
68
|
+
/// Restriction placed on the origin of incoming connections to the edge to deny these CIDR ranges.
|
|
69
|
+
#[napi(
|
|
70
|
+
js_name = "ip_restriction_deny_cidrs",
|
|
71
|
+
ts_type = "string|Array<string>"
|
|
72
|
+
)]
|
|
73
|
+
pub deny_cidr: Option<Vec<String>>,
|
|
74
|
+
/// The certificate to use for TLS termination at the ngrok edge in PEM format.
|
|
75
|
+
/// Only used if "proto" is "tls".
|
|
76
|
+
pub key: Option<String>,
|
|
77
|
+
/// Add label, value pairs for this tunnel, colon separated.
|
|
78
|
+
#[napi(ts_type = "string|Array<string>")]
|
|
79
|
+
pub labels: Option<Vec<String>>,
|
|
80
|
+
/// Tunnel-specific opaque metadata. Viewable via the API.
|
|
81
|
+
pub metadata: Option<String>,
|
|
82
|
+
/// Certificates to use for client authentication at the ngrok edge.
|
|
83
|
+
/// Only used if "proto" is "tls" or "http".
|
|
84
|
+
#[napi(js_name = "mutual_tls_cas", ts_type = "string|Array<string>")]
|
|
85
|
+
pub mutual_tls_cas: Option<Vec<String>>,
|
|
86
|
+
/// Unused, will warn and be ignored
|
|
87
|
+
pub name: Option<String>,
|
|
88
|
+
/// OAuth configuration of domains to allow.
|
|
89
|
+
#[napi(js_name = "oauth_allow_domains", ts_type = "string|Array<string>")]
|
|
90
|
+
pub oauth_allow_domains: Option<Vec<String>>,
|
|
91
|
+
/// OAuth configuration of email addresses to allow.
|
|
92
|
+
#[napi(js_name = "oauth_allow_emails", ts_type = "string|Array<string>")]
|
|
93
|
+
pub oauth_allow_emails: Option<Vec<String>>,
|
|
94
|
+
/// OAuth configuration of scopes.
|
|
95
|
+
#[napi(js_name = "oauth_scopes", ts_type = "string|Array<string>")]
|
|
96
|
+
pub oauth_scopes: Option<Vec<String>>,
|
|
97
|
+
/// OAuth configuration of the provider, e.g. "google".
|
|
98
|
+
/// https://ngrok.com/docs/cloud-edge/modules/oauth/
|
|
99
|
+
#[napi(js_name = "oauth_provider")]
|
|
100
|
+
pub oauth_provider: Option<String>,
|
|
101
|
+
/// OIDC configuration of client ID.
|
|
102
|
+
#[napi(js_name = "oidc_client_id")]
|
|
103
|
+
pub oidc_client_id: Option<String>,
|
|
104
|
+
/// OIDC configuration of client secret.
|
|
105
|
+
#[napi(js_name = "oidc_client_secret")]
|
|
106
|
+
pub oidc_client_secret: Option<String>,
|
|
107
|
+
/// OIDC configuration of scopes.
|
|
108
|
+
#[napi(js_name = "oidc_scopes", ts_type = "string|Array<string>")]
|
|
109
|
+
pub oidc_scopes: Option<Vec<String>>,
|
|
110
|
+
/// OIDC configuration of the issuer URL.
|
|
111
|
+
#[napi(js_name = "oidc_issuer_url")]
|
|
112
|
+
pub oidc_issuer_url: Option<String>,
|
|
113
|
+
/// OIDC configuration of domains to allow.
|
|
114
|
+
#[napi(js_name = "oidc_allow_domains", ts_type = "string|Array<string>")]
|
|
115
|
+
pub oidc_allow_domains: Option<Vec<String>>,
|
|
116
|
+
/// OIDC configuration of email addresses to allow.
|
|
117
|
+
#[napi(js_name = "oidc_allow_emails", ts_type = "string|Array<string>")]
|
|
118
|
+
pub oidc_allow_emails: Option<Vec<String>>,
|
|
119
|
+
/// Returns log messages from the ngrok library.
|
|
120
|
+
#[napi(ts_type = "(data: string) => void")]
|
|
121
|
+
pub on_log_event: Option<bool>,
|
|
122
|
+
/// 'closed' - connection is lost, 'connected' - reconnected
|
|
123
|
+
#[napi(ts_type = "(status: string) => void")]
|
|
124
|
+
pub on_status_change: Option<bool>,
|
|
125
|
+
/// The port for the tunnel to forward to.
|
|
126
|
+
/// Only used if addr is not defined.
|
|
127
|
+
pub port: Option<u32>,
|
|
128
|
+
/// The type of tunnel to use, one of http|tcp|tls|labeled, defaults to http.
|
|
129
|
+
pub proto: Option<String>,
|
|
130
|
+
/// The version of PROXY protocol to use with this tunnel "1", "2", or "" if not using.
|
|
131
|
+
#[napi(js_name = "proxy_proto")]
|
|
132
|
+
pub proxy_proto: Option<String>,
|
|
133
|
+
/// Adds a header to all requests to this edge.
|
|
134
|
+
#[napi(js_name = "request_header_add", ts_type = "string|Array<string>")]
|
|
135
|
+
pub request_header_add: Option<Vec<String>>,
|
|
136
|
+
/// Removes a header from requests to this edge.
|
|
137
|
+
#[napi(js_name = "request_header_remove", ts_type = "string|Array<string>")]
|
|
138
|
+
pub request_header_remove: Option<Vec<String>>,
|
|
139
|
+
/// Adds a header to all responses coming from this edge.
|
|
140
|
+
#[napi(js_name = "response_header_add", ts_type = "string|Array<string>")]
|
|
141
|
+
pub response_header_add: Option<Vec<String>>,
|
|
142
|
+
/// Removes a header from responses from this edge.
|
|
143
|
+
#[napi(js_name = "response_header_remove", ts_type = "string|Array<string>")]
|
|
144
|
+
pub response_header_remove: Option<Vec<String>>,
|
|
145
|
+
/// Unused, will warn and be ignored
|
|
146
|
+
pub region: Option<String>,
|
|
147
|
+
/// The TCP address to request for this edge.
|
|
148
|
+
/// Only used if proto is "tcp".
|
|
149
|
+
#[napi(js_name = "remote_addr")]
|
|
150
|
+
pub remote_addr: Option<String>,
|
|
151
|
+
/// The scheme that this edge should use, defaults to "https".
|
|
152
|
+
/// If multiple are given only the last one is used.
|
|
153
|
+
#[napi(ts_type = "string|Array<string>")]
|
|
154
|
+
pub schemes: Option<Vec<String>>,
|
|
155
|
+
/// Configures the opaque, machine-readable metadata string for this session.
|
|
156
|
+
/// Metadata is made available to you in the ngrok dashboard and the Agents API
|
|
157
|
+
/// resource. It is a useful way to allow you to uniquely identify sessions. We
|
|
158
|
+
/// suggest encoding the value in a structured format like JSON.
|
|
159
|
+
///
|
|
160
|
+
/// See the [metdata parameter in the ngrok docs] for additional details.
|
|
161
|
+
///
|
|
162
|
+
/// [metdata parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#metadata
|
|
163
|
+
#[napi(js_name = "session_metadata")]
|
|
164
|
+
pub session_metadata: Option<String>,
|
|
165
|
+
/// Unused, use domain instead, will warn and be ignored
|
|
166
|
+
pub subdomain: Option<String>,
|
|
167
|
+
/// Unused, will warn and be ignored
|
|
168
|
+
#[napi(js_name = "terminate_at")]
|
|
169
|
+
pub terminate_at: Option<String>,
|
|
170
|
+
/// WebhookVerification configuration, the provider to use.
|
|
171
|
+
#[napi(js_name = "verify_webhook_provider")]
|
|
172
|
+
pub verify_webhook_provider: Option<String>,
|
|
173
|
+
/// WebhookVerification configuration, the secret to use.
|
|
174
|
+
#[napi(js_name = "verify_webhook_secret")]
|
|
175
|
+
pub verify_webhook_secret: Option<String>,
|
|
176
|
+
/// Unused, will warn and be ignored
|
|
177
|
+
#[napi(js_name = "web_addr")]
|
|
178
|
+
pub web_addr: Option<String>,
|
|
179
|
+
/// Convert incoming websocket connections to TCP-like streams.
|
|
180
|
+
#[napi(js_name = "websocket_tcp_converter")]
|
|
181
|
+
pub websocket_tcp_converter: Option<bool>,
|
|
182
|
+
}
|