@ngrok/ngrok 1.1.0 → 1.2.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 CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.2.0:
2
+
3
+ - 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.
4
+
5
+ ## 1.1.1:
6
+
7
+ - Add `appProtocol(string)` to the labeled listener builder. Setting this to "http2" will enable HTTP/2 support to the backend application.
8
+
1
9
  ## 1.1.0:
2
10
 
3
11
  - Add `appProtocol(string)` to http listener builder, and `app_protocol: string` as a `ngrok.forward()` argument. Setting this to "http2" will enable HTTP/2 support to the backend application.
package/README.md CHANGED
@@ -69,7 +69,7 @@ A quickstart guide and a full API reference are included in the [ngrok-javascrip
69
69
 
70
70
  ### Authorization
71
71
 
72
- To use most of ngrok's features, you'll need an authtoken. To obtain one, sign up for free at [ngrok.com](https://dashboard.ngrok.com/signup) and retrieve it from the [authtoken page of your ngrok dashboard](https://dashboard.ngrok.com/get-started/your-authtoken). Once you have copied your authtoken, you can reference it in several ways.
72
+ To use ngrok you'll need an authtoken. To obtain one, sign up for free at [ngrok.com](https://dashboard.ngrok.com/signup) and retrieve it from the [authtoken page of your ngrok dashboard](https://dashboard.ngrok.com/get-started/your-authtoken). Once you have copied your authtoken, you can reference it in several ways.
73
73
 
74
74
  You can set it in the `NGROK_AUTHTOKEN` environment variable and pass `authtoken_from_env: true` to the [forward](https://ngrok.github.io/ngrok-javascript/functions/forward.html) method:
75
75
 
package/index.d.ts CHANGED
@@ -289,6 +289,8 @@ export interface Config {
289
289
  subdomain?: string
290
290
  /** Unused, will warn and be ignored */
291
291
  terminate_at?: string
292
+ /** Whether to disable certificate verification for this listener */
293
+ verify_upstream_tls?: boolean
292
294
  /**
293
295
  * WebhookVerification configuration, the provider to use.
294
296
  * See [Webhook Verification] in the ngrok docs for additional details.
@@ -509,6 +511,8 @@ export class HttpListenerBuilder {
509
511
  webhookVerification(provider: string, secret: string): this
510
512
  /** Listener-specific opaque metadata. Viewable via the API. */
511
513
  metadata(metadata: string): this
514
+ /** Whether to disable certificate verification for this listener. */
515
+ verifyUpstreamTls(verifyUpstreamTls: boolean): this
512
516
  /** Begin listening for new connections on this listener. */
513
517
  listen(bind?: boolean | undefined | null): Promise<Listener>
514
518
  /**
@@ -558,6 +562,8 @@ export class HttpListenerBuilder {
558
562
  export class TcpListenerBuilder {
559
563
  /** Listener-specific opaque metadata. Viewable via the API. */
560
564
  metadata(metadata: string): this
565
+ /** Whether to disable certificate verification for this listener. */
566
+ verifyUpstreamTls(verifyUpstreamTls: boolean): this
561
567
  /** Begin listening for new connections on this listener. */
562
568
  listen(bind?: boolean | undefined | null): Promise<Listener>
563
569
  /**
@@ -614,6 +620,8 @@ export class TcpListenerBuilder {
614
620
  export class TlsListenerBuilder {
615
621
  /** Listener-specific opaque metadata. Viewable via the API. */
616
622
  metadata(metadata: string): this
623
+ /** Whether to disable certificate verification for this listener. */
624
+ verifyUpstreamTls(verifyUpstreamTls: boolean): this
617
625
  /** Begin listening for new connections on this listener. */
618
626
  listen(bind?: boolean | undefined | null): Promise<Listener>
619
627
  /**
@@ -685,6 +693,8 @@ export class TlsListenerBuilder {
685
693
  export class LabeledListenerBuilder {
686
694
  /** Listener-specific opaque metadata. Viewable via the API. */
687
695
  metadata(metadata: string): this
696
+ /** Whether to disable certificate verification for this listener. */
697
+ verifyUpstreamTls(verifyUpstreamTls: boolean): this
688
698
  /** Begin listening for new connections on this listener. */
689
699
  listen(bind?: boolean | undefined | null): Promise<Listener>
690
700
  /**
@@ -704,6 +714,8 @@ export class LabeledListenerBuilder {
704
714
  * [Using Labels]: https://ngrok.com/docs/guides/using-labels-within-ngrok/
705
715
  */
706
716
  label(label: string, value: string): this
717
+ /** Set the L7 application portocol for this listener, i.e. "http1" or "http2" (defaults "http1") */
718
+ appProtocol(appProtocol: string): this
707
719
  }
708
720
  /**
709
721
  * The builder for an ngrok session.
package/index.js CHANGED
@@ -501,28 +501,31 @@ async function ngrokLinkPipe(listener, server) {
501
501
  }
502
502
 
503
503
  // protect against multiple calls, for instance from npm
504
- var sigintRan = false;
504
+ var sigHandlerRan = false;
505
505
 
506
506
  function registerCleanup(listener, socket) {
507
- process.on("SIGINT", function () {
508
- if (sigintRan) return;
509
- sigintRan = true;
507
+ for (const signal of ["SIGINT", "SIGTERM"]) {
508
+ process.on(signal, function () {
509
+ if (process.listenerCount(signal) > 1) {
510
+ // user has registered a handler, abort this one
511
+ return;
512
+ }
510
513
 
511
- if (process.listenerCount("SIGINT") > 1) {
512
- // user has registered a handler, abort this one
513
- return;
514
- }
515
- // close listener
516
- if (listener) {
517
- listener.close().catch((err) => {
518
- console.error(`Error closing listener: ${err}`);
519
- });
520
- }
521
- // close webserver's socket
522
- if (socket) socket.close();
523
- // unregister any logging callback
524
- loggingCallback();
525
- });
514
+ if (sigHandlerRan) return;
515
+ sigHandlerRan = true;
516
+
517
+ // close listener
518
+ if (listener) {
519
+ listener.close().catch((err) => {
520
+ console.error(`Error closing listener: ${err}`);
521
+ });
522
+ }
523
+ // close webserver's socket
524
+ if (socket) socket.close();
525
+ // unregister any logging callback
526
+ loggingCallback();
527
+ });
528
+ }
526
529
  }
527
530
 
528
531
  function consoleLog(level) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrok/ngrok",
3
- "version": "1.1.0",
3
+ "version": "1.2.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.1.0",
80
- "@ngrok/ngrok-darwin-x64": "1.1.0",
81
- "@ngrok/ngrok-linux-x64-gnu": "1.1.0",
82
- "@ngrok/ngrok-darwin-arm64": "1.1.0",
83
- "@ngrok/ngrok-android-arm64": "1.1.0",
84
- "@ngrok/ngrok-linux-arm64-gnu": "1.1.0",
85
- "@ngrok/ngrok-linux-arm64-musl": "1.1.0",
86
- "@ngrok/ngrok-linux-arm-gnueabihf": "1.1.0",
87
- "@ngrok/ngrok-linux-x64-musl": "1.1.0",
88
- "@ngrok/ngrok-freebsd-x64": "1.1.0",
89
- "@ngrok/ngrok-win32-ia32-msvc": "1.1.0",
90
- "@ngrok/ngrok-android-arm-eabi": "1.1.0",
91
- "@ngrok/ngrok-darwin-universal": "1.1.0"
79
+ "@ngrok/ngrok-win32-x64-msvc": "1.2.0",
80
+ "@ngrok/ngrok-darwin-x64": "1.2.0",
81
+ "@ngrok/ngrok-linux-x64-gnu": "1.2.0",
82
+ "@ngrok/ngrok-darwin-arm64": "1.2.0",
83
+ "@ngrok/ngrok-android-arm64": "1.2.0",
84
+ "@ngrok/ngrok-linux-arm64-gnu": "1.2.0",
85
+ "@ngrok/ngrok-linux-arm64-musl": "1.2.0",
86
+ "@ngrok/ngrok-linux-arm-gnueabihf": "1.2.0",
87
+ "@ngrok/ngrok-linux-x64-musl": "1.2.0",
88
+ "@ngrok/ngrok-freebsd-x64": "1.2.0",
89
+ "@ngrok/ngrok-win32-ia32-msvc": "1.2.0",
90
+ "@ngrok/ngrok-android-arm-eabi": "1.2.0",
91
+ "@ngrok/ngrok-darwin-universal": "1.2.0"
92
92
  }
93
93
  }