@ngrok/ngrok 1.1.1 → 1.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/CHANGELOG.md +9 -0
- package/README.md +6 -1
- package/index.d.ts +55 -0
- package/index.js +7 -0
- package/package.json +14 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 1.3.0:
|
|
2
|
+
|
|
3
|
+
- Add `rootCas` to session builder and `root_cas` to `ngrok.forward`. Setting this to `host` will use the host's trusted certificates to connect for the ngrok session.
|
|
4
|
+
- Add `session_ca_cert` and `server_addr` to `ngrok.forward`, which correspond to the same functions in the session builder.
|
|
5
|
+
|
|
6
|
+
## 1.2.0:
|
|
7
|
+
|
|
8
|
+
- Add `verifyUpstreamTls` to listener builders and `verify_upstream_tls` to `ngrok.forward`. Setting this to false will skip verification of the upstream application's TLS certificate.
|
|
9
|
+
|
|
1
10
|
## 1.1.1:
|
|
2
11
|
|
|
3
12
|
- Add `appProtocol(string)` to the labeled listener builder. Setting this to "http2" will enable HTTP/2 support to the backend application.
|
package/README.md
CHANGED
|
@@ -185,7 +185,7 @@ As of version `0.7.0` there is backend TLS connection support, validated by a fi
|
|
|
185
185
|
await ngrok.forward({ addr: "https://127.0.0.1:3000", authtoken_from_env: true });
|
|
186
186
|
```
|
|
187
187
|
|
|
188
|
-
If the service is using certs not trusted by the OS, such as self-signed certificates, add an environment variable like this before running: `SSL_CERT_FILE=/path/to/ca.crt`.
|
|
188
|
+
If the service is using certs not trusted by the OS, such as self-signed certificates, add an environment variable like this before running: `SSL_CERT_FILE=/path/to/ca.crt`. There is also a `verify_upstream_tls: false` option to disable certification verification.
|
|
189
189
|
|
|
190
190
|
### Async Programming
|
|
191
191
|
|
|
@@ -223,6 +223,10 @@ const listener = await ngrok.forward({
|
|
|
223
223
|
console.log(`disconnected, addr ${addr} error: ${error}`);
|
|
224
224
|
},
|
|
225
225
|
session_metadata: "Online in One Line",
|
|
226
|
+
// advanced session connection configuration
|
|
227
|
+
server_addr: "example.com:443",
|
|
228
|
+
root_cas: "trusted",
|
|
229
|
+
session_ca_cert: fs.readFileSync("ca.pem", "utf8"),
|
|
226
230
|
// listener configuration
|
|
227
231
|
metadata: "example listener metadata from javascript",
|
|
228
232
|
domain: "<domain>",
|
|
@@ -259,6 +263,7 @@ const listener = await ngrok.forward({
|
|
|
259
263
|
response_header_remove: ["X-Res-Nope"],
|
|
260
264
|
request_header_add: ["X-Req-Yup:true"],
|
|
261
265
|
response_header_add: ["X-Res-Yup:true"],
|
|
266
|
+
verify_upstream_tls: false,
|
|
262
267
|
verify_webhook_provider: "twilio",
|
|
263
268
|
verify_webhook_secret: "asdf",
|
|
264
269
|
websocket_tcp_converter: true,
|
package/index.d.ts
CHANGED
|
@@ -76,6 +76,8 @@ export interface Config {
|
|
|
76
76
|
* and the API.
|
|
77
77
|
*/
|
|
78
78
|
forwards_to?: string
|
|
79
|
+
/** Force a new session connection to be made. */
|
|
80
|
+
force_new_session?: boolean
|
|
79
81
|
/** Unused, will warn and be ignored */
|
|
80
82
|
host_header?: string
|
|
81
83
|
/**
|
|
@@ -268,12 +270,35 @@ export interface Config {
|
|
|
268
270
|
* [ngrok dashboard]: https://dashboard.ngrok.com/cloud-edge/tcp-addresses
|
|
269
271
|
*/
|
|
270
272
|
remote_addr?: string
|
|
273
|
+
/**
|
|
274
|
+
* Sets the file path to a default certificate in PEM format to validate ngrok Session TLS connections.
|
|
275
|
+
* Setting to "trusted" is the default, using the ngrok CA certificate.
|
|
276
|
+
* Setting to "host" will verify using the certificates on the host operating system.
|
|
277
|
+
* A client config set via tls_config after calling root_cas will override this value.
|
|
278
|
+
*
|
|
279
|
+
* Corresponds to the [root_cas parameter in the ngrok docs]
|
|
280
|
+
*
|
|
281
|
+
* [root_cas parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#root_cas
|
|
282
|
+
*/
|
|
283
|
+
root_cas?: string
|
|
271
284
|
/**
|
|
272
285
|
* The scheme that this edge should use.
|
|
273
286
|
* "HTTPS" or "HTTP", defaults to "HTTPS".
|
|
274
287
|
* If multiple are given only the last one is used.
|
|
275
288
|
*/
|
|
276
289
|
schemes?: string|Array<string>
|
|
290
|
+
/**
|
|
291
|
+
* Configures the TLS certificate used to connect to the ngrok service while
|
|
292
|
+
* establishing the session. Use this option only if you are connecting through
|
|
293
|
+
* a man-in-the-middle or deep packet inspection proxy. Pass in the bytes of the certificate
|
|
294
|
+
* to be used to validate the connection, then override the address to connect to via
|
|
295
|
+
* the server_addr call.
|
|
296
|
+
*
|
|
297
|
+
* Roughly corresponds to the [root_cas parameter in the ngrok docs].
|
|
298
|
+
*
|
|
299
|
+
* [root_cas parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#root_cas
|
|
300
|
+
*/
|
|
301
|
+
session_ca_cert?: string
|
|
277
302
|
/**
|
|
278
303
|
* Configures the opaque, machine-readable metadata string for this session.
|
|
279
304
|
* Metadata is made available to you in the ngrok dashboard and the Agents API
|
|
@@ -285,10 +310,21 @@ export interface Config {
|
|
|
285
310
|
* [metdata parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#metadata
|
|
286
311
|
*/
|
|
287
312
|
session_metadata?: string
|
|
313
|
+
/**
|
|
314
|
+
* Configures the network address to dial to connect to the ngrok service.
|
|
315
|
+
* Use this option only if you are connecting to a custom agent ingress.
|
|
316
|
+
*
|
|
317
|
+
* See the [server_addr parameter in the ngrok docs] for additional details.
|
|
318
|
+
*
|
|
319
|
+
* [server_addr parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#server_addr
|
|
320
|
+
*/
|
|
321
|
+
server_addr?: string
|
|
288
322
|
/** Unused, use domain instead, will warn and be ignored */
|
|
289
323
|
subdomain?: string
|
|
290
324
|
/** Unused, will warn and be ignored */
|
|
291
325
|
terminate_at?: string
|
|
326
|
+
/** Whether to disable certificate verification for this listener */
|
|
327
|
+
verify_upstream_tls?: boolean
|
|
292
328
|
/**
|
|
293
329
|
* WebhookVerification configuration, the provider to use.
|
|
294
330
|
* See [Webhook Verification] in the ngrok docs for additional details.
|
|
@@ -509,6 +545,8 @@ export class HttpListenerBuilder {
|
|
|
509
545
|
webhookVerification(provider: string, secret: string): this
|
|
510
546
|
/** Listener-specific opaque metadata. Viewable via the API. */
|
|
511
547
|
metadata(metadata: string): this
|
|
548
|
+
/** Whether to disable certificate verification for this listener. */
|
|
549
|
+
verifyUpstreamTls(verifyUpstreamTls: boolean): this
|
|
512
550
|
/** Begin listening for new connections on this listener. */
|
|
513
551
|
listen(bind?: boolean | undefined | null): Promise<Listener>
|
|
514
552
|
/**
|
|
@@ -558,6 +596,8 @@ export class HttpListenerBuilder {
|
|
|
558
596
|
export class TcpListenerBuilder {
|
|
559
597
|
/** Listener-specific opaque metadata. Viewable via the API. */
|
|
560
598
|
metadata(metadata: string): this
|
|
599
|
+
/** Whether to disable certificate verification for this listener. */
|
|
600
|
+
verifyUpstreamTls(verifyUpstreamTls: boolean): this
|
|
561
601
|
/** Begin listening for new connections on this listener. */
|
|
562
602
|
listen(bind?: boolean | undefined | null): Promise<Listener>
|
|
563
603
|
/**
|
|
@@ -614,6 +654,8 @@ export class TcpListenerBuilder {
|
|
|
614
654
|
export class TlsListenerBuilder {
|
|
615
655
|
/** Listener-specific opaque metadata. Viewable via the API. */
|
|
616
656
|
metadata(metadata: string): this
|
|
657
|
+
/** Whether to disable certificate verification for this listener. */
|
|
658
|
+
verifyUpstreamTls(verifyUpstreamTls: boolean): this
|
|
617
659
|
/** Begin listening for new connections on this listener. */
|
|
618
660
|
listen(bind?: boolean | undefined | null): Promise<Listener>
|
|
619
661
|
/**
|
|
@@ -685,6 +727,8 @@ export class TlsListenerBuilder {
|
|
|
685
727
|
export class LabeledListenerBuilder {
|
|
686
728
|
/** Listener-specific opaque metadata. Viewable via the API. */
|
|
687
729
|
metadata(metadata: string): this
|
|
730
|
+
/** Whether to disable certificate verification for this listener. */
|
|
731
|
+
verifyUpstreamTls(verifyUpstreamTls: boolean): this
|
|
688
732
|
/** Begin listening for new connections on this listener. */
|
|
689
733
|
listen(bind?: boolean | undefined | null): Promise<Listener>
|
|
690
734
|
/**
|
|
@@ -784,6 +828,17 @@ export class SessionBuilder {
|
|
|
784
828
|
* [server_addr parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#server_addr
|
|
785
829
|
*/
|
|
786
830
|
serverAddr(addr: string): this
|
|
831
|
+
/**
|
|
832
|
+
* Sets the file path to a default certificate in PEM format to validate ngrok Session TLS connections.
|
|
833
|
+
* Setting to "trusted" is the default, using the ngrok CA certificate.
|
|
834
|
+
* Setting to "host" will verify using the certificates on the host operating system.
|
|
835
|
+
* A client config set via tls_config after calling root_cas will override this value.
|
|
836
|
+
*
|
|
837
|
+
* Corresponds to the [root_cas parameter in the ngrok docs]
|
|
838
|
+
*
|
|
839
|
+
* [root_cas parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#root_cas
|
|
840
|
+
*/
|
|
841
|
+
rootCas(rootCas: string): this
|
|
787
842
|
/**
|
|
788
843
|
* Configures the TLS certificate used to connect to the ngrok service while
|
|
789
844
|
* establishing the session. Use this option only if you are connecting through
|
package/index.js
CHANGED
|
@@ -545,6 +545,13 @@ async function ngrokForward(config) {
|
|
|
545
545
|
}
|
|
546
546
|
config = { addr: address };
|
|
547
547
|
}
|
|
548
|
+
if (typeof config["port"] === "string" || config["port"] instanceof String) {
|
|
549
|
+
const num = parseInt(config["port"], 10);
|
|
550
|
+
if (isNaN(num)) {
|
|
551
|
+
throw new Error(`port must be a number: '${config["port"]}'`);
|
|
552
|
+
}
|
|
553
|
+
config["port"] = num;
|
|
554
|
+
}
|
|
548
555
|
// Convert addr to string to allow for numeric port numbers
|
|
549
556
|
const addr = config["addr"];
|
|
550
557
|
if (Number.isInteger(addr)) config["addr"] = "localhost:" + String(config["addr"]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrok/ngrok",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -76,18 +76,18 @@
|
|
|
76
76
|
"url": "https://github.com/ngrok/ngrok-javascript.git"
|
|
77
77
|
},
|
|
78
78
|
"optionalDependencies": {
|
|
79
|
-
"@ngrok/ngrok-win32-x64-msvc": "1.
|
|
80
|
-
"@ngrok/ngrok-darwin-x64": "1.
|
|
81
|
-
"@ngrok/ngrok-linux-x64-gnu": "1.
|
|
82
|
-
"@ngrok/ngrok-darwin-arm64": "1.
|
|
83
|
-
"@ngrok/ngrok-android-arm64": "1.
|
|
84
|
-
"@ngrok/ngrok-linux-arm64-gnu": "1.
|
|
85
|
-
"@ngrok/ngrok-linux-arm64-musl": "1.
|
|
86
|
-
"@ngrok/ngrok-linux-arm-gnueabihf": "1.
|
|
87
|
-
"@ngrok/ngrok-linux-x64-musl": "1.
|
|
88
|
-
"@ngrok/ngrok-freebsd-x64": "1.
|
|
89
|
-
"@ngrok/ngrok-win32-ia32-msvc": "1.
|
|
90
|
-
"@ngrok/ngrok-android-arm-eabi": "1.
|
|
91
|
-
"@ngrok/ngrok-darwin-universal": "1.
|
|
79
|
+
"@ngrok/ngrok-win32-x64-msvc": "1.3.0",
|
|
80
|
+
"@ngrok/ngrok-darwin-x64": "1.3.0",
|
|
81
|
+
"@ngrok/ngrok-linux-x64-gnu": "1.3.0",
|
|
82
|
+
"@ngrok/ngrok-darwin-arm64": "1.3.0",
|
|
83
|
+
"@ngrok/ngrok-android-arm64": "1.3.0",
|
|
84
|
+
"@ngrok/ngrok-linux-arm64-gnu": "1.3.0",
|
|
85
|
+
"@ngrok/ngrok-linux-arm64-musl": "1.3.0",
|
|
86
|
+
"@ngrok/ngrok-linux-arm-gnueabihf": "1.3.0",
|
|
87
|
+
"@ngrok/ngrok-linux-x64-musl": "1.3.0",
|
|
88
|
+
"@ngrok/ngrok-freebsd-x64": "1.3.0",
|
|
89
|
+
"@ngrok/ngrok-win32-ia32-msvc": "1.3.0",
|
|
90
|
+
"@ngrok/ngrok-android-arm-eabi": "1.3.0",
|
|
91
|
+
"@ngrok/ngrok-darwin-universal": "1.3.0"
|
|
92
92
|
}
|
|
93
93
|
}
|