@ngrok/ngrok 1.1.0 → 1.1.1

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,7 @@
1
+ ## 1.1.1:
2
+
3
+ - Add `appProtocol(string)` to the labeled listener builder. Setting this to "http2" will enable HTTP/2 support to the backend application.
4
+
1
5
  ## 1.1.0:
2
6
 
3
7
  - 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
@@ -704,6 +704,8 @@ export class LabeledListenerBuilder {
704
704
  * [Using Labels]: https://ngrok.com/docs/guides/using-labels-within-ngrok/
705
705
  */
706
706
  label(label: string, value: string): this
707
+ /** Set the L7 application portocol for this listener, i.e. "http1" or "http2" (defaults "http1") */
708
+ appProtocol(appProtocol: string): this
707
709
  }
708
710
  /**
709
711
  * 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.1.1",
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.1.1",
80
+ "@ngrok/ngrok-darwin-x64": "1.1.1",
81
+ "@ngrok/ngrok-linux-x64-gnu": "1.1.1",
82
+ "@ngrok/ngrok-darwin-arm64": "1.1.1",
83
+ "@ngrok/ngrok-android-arm64": "1.1.1",
84
+ "@ngrok/ngrok-linux-arm64-gnu": "1.1.1",
85
+ "@ngrok/ngrok-linux-arm64-musl": "1.1.1",
86
+ "@ngrok/ngrok-linux-arm-gnueabihf": "1.1.1",
87
+ "@ngrok/ngrok-linux-x64-musl": "1.1.1",
88
+ "@ngrok/ngrok-freebsd-x64": "1.1.1",
89
+ "@ngrok/ngrok-win32-ia32-msvc": "1.1.1",
90
+ "@ngrok/ngrok-android-arm-eabi": "1.1.1",
91
+ "@ngrok/ngrok-darwin-universal": "1.1.1"
92
92
  }
93
93
  }