@ngrok/ngrok 0.0.11 → 0.1.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 +17 -0
- package/Cargo.toml +5 -3
- package/README.md +2 -4
- package/RELEASE.md +13 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/NgrokHttpTunnel.html +9 -9
- package/docs/classes/NgrokHttpTunnelBuilder.html +21 -21
- package/docs/classes/NgrokLabeledTunnel.html +8 -8
- package/docs/classes/NgrokLabeledTunnelBuilder.html +4 -4
- package/docs/classes/NgrokSession.html +19 -7
- package/docs/classes/NgrokSessionBuilder.html +100 -12
- package/docs/classes/NgrokTcpTunnel.html +9 -9
- package/docs/classes/NgrokTcpTunnelBuilder.html +8 -8
- package/docs/classes/NgrokTlsTunnel.html +9 -9
- package/docs/classes/NgrokTlsTunnelBuilder.html +10 -10
- package/docs/classes/UpdateRequest.html +3 -3
- package/docs/functions/consoleLog.html +1 -1
- package/docs/functions/listen.html +1 -1
- package/docs/functions/listenable.html +1 -1
- package/docs/functions/loggingCallback.html +1 -1
- package/docs/index.html +1 -2
- package/examples/ngrok-express-quickstart.js +11 -0
- package/examples/ngrok-express.js +18 -3
- package/examples/ngrok-http-full.js +11 -1
- package/index.d.ts +31 -0
- package/index.js +8 -1
- package/package.json +15 -16
- package/src/session.rs +143 -11
- package/trailer.js +8 -1
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<ul class="tsd-hierarchy">
|
|
24
24
|
<li><span class="target">NgrokTlsTunnelBuilder</span></li></ul></section><aside class="tsd-sources">
|
|
25
25
|
<ul>
|
|
26
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
26
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L398">index.d.ts:398</a></li></ul></aside>
|
|
27
27
|
<section class="tsd-panel-group tsd-index-group">
|
|
28
28
|
<section class="tsd-panel tsd-index-panel">
|
|
29
29
|
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
|
@@ -70,7 +70,7 @@ Call multiple times to add additional CIDR ranges.</p>
|
|
|
70
70
|
<h5>cidr: <span class="tsd-signature-type">string</span></h5></li></ul></div>
|
|
71
71
|
<h4 class="tsd-returns-title">Returns <a href="NgrokTlsTunnelBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnelBuilder</a></h4><aside class="tsd-sources">
|
|
72
72
|
<ul>
|
|
73
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
73
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L413">index.d.ts:413</a></li></ul></aside></li></ul></section>
|
|
74
74
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="denyCidr" class="tsd-anchor"></a>
|
|
75
75
|
<h3 class="tsd-anchor-link"><span>deny<wbr/>Cidr</span><a href="#denyCidr" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
76
76
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -86,7 +86,7 @@ Call multiple times to add additional CIDR ranges.</p>
|
|
|
86
86
|
<h5>cidr: <span class="tsd-signature-type">string</span></h5></li></ul></div>
|
|
87
87
|
<h4 class="tsd-returns-title">Returns <a href="NgrokTlsTunnelBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnelBuilder</a></h4><aside class="tsd-sources">
|
|
88
88
|
<ul>
|
|
89
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
89
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L418">index.d.ts:418</a></li></ul></aside></li></ul></section>
|
|
90
90
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="domain" class="tsd-anchor"></a>
|
|
91
91
|
<h3 class="tsd-anchor-link"><span>domain</span><a href="#domain" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
92
92
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -101,7 +101,7 @@ Call multiple times to add additional CIDR ranges.</p>
|
|
|
101
101
|
<h5>domain: <span class="tsd-signature-type">string</span></h5></li></ul></div>
|
|
102
102
|
<h4 class="tsd-returns-title">Returns <a href="NgrokTlsTunnelBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnelBuilder</a></h4><aside class="tsd-sources">
|
|
103
103
|
<ul>
|
|
104
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
104
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L400">index.d.ts:400</a></li></ul></aside></li></ul></section>
|
|
105
105
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="forwardsTo" class="tsd-anchor"></a>
|
|
106
106
|
<h3 class="tsd-anchor-link"><span>forwards<wbr/>To</span><a href="#forwardsTo" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
107
107
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -117,7 +117,7 @@ bearing on tunnel behavior.</p>
|
|
|
117
117
|
<h5>forwardsTo: <span class="tsd-signature-type">string</span></h5></li></ul></div>
|
|
118
118
|
<h4 class="tsd-returns-title">Returns <a href="NgrokTlsTunnelBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnelBuilder</a></h4><aside class="tsd-sources">
|
|
119
119
|
<ul>
|
|
120
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
120
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L425">index.d.ts:425</a></li></ul></aside></li></ul></section>
|
|
121
121
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="listen" class="tsd-anchor"></a>
|
|
122
122
|
<h3 class="tsd-anchor-link"><span>listen</span><a href="#listen" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
123
123
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -132,7 +132,7 @@ bearing on tunnel behavior.</p>
|
|
|
132
132
|
<h5><code class="tsd-tag ts-flagOptional">Optional</code> bind: <span class="tsd-signature-type">boolean</span></h5></li></ul></div>
|
|
133
133
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Promise</span><span class="tsd-signature-symbol"><</span><a href="NgrokTlsTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnel</a><span class="tsd-signature-symbol">></span></h4><aside class="tsd-sources">
|
|
134
134
|
<ul>
|
|
135
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
135
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L408">index.d.ts:408</a></li></ul></aside></li></ul></section>
|
|
136
136
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="metadata" class="tsd-anchor"></a>
|
|
137
137
|
<h3 class="tsd-anchor-link"><span>metadata</span><a href="#metadata" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
138
138
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -147,7 +147,7 @@ bearing on tunnel behavior.</p>
|
|
|
147
147
|
<h5>metadata: <span class="tsd-signature-type">string</span></h5></li></ul></div>
|
|
148
148
|
<h4 class="tsd-returns-title">Returns <a href="NgrokTlsTunnelBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnelBuilder</a></h4><aside class="tsd-sources">
|
|
149
149
|
<ul>
|
|
150
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
150
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L406">index.d.ts:406</a></li></ul></aside></li></ul></section>
|
|
151
151
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="mutualTlsca" class="tsd-anchor"></a>
|
|
152
152
|
<h3 class="tsd-anchor-link"><span>mutual<wbr/>Tlsca</span><a href="#mutualTlsca" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
153
153
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -162,7 +162,7 @@ bearing on tunnel behavior.</p>
|
|
|
162
162
|
<h5>mutualTlsca: <span class="tsd-signature-type">Uint8Array</span></h5></li></ul></div>
|
|
163
163
|
<h4 class="tsd-returns-title">Returns <a href="NgrokTlsTunnelBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnelBuilder</a></h4><aside class="tsd-sources">
|
|
164
164
|
<ul>
|
|
165
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
165
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L402">index.d.ts:402</a></li></ul></aside></li></ul></section>
|
|
166
166
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="proxyProto" class="tsd-anchor"></a>
|
|
167
167
|
<h3 class="tsd-anchor-link"><span>proxy<wbr/>Proto</span><a href="#proxyProto" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
168
168
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -177,7 +177,7 @@ bearing on tunnel behavior.</p>
|
|
|
177
177
|
<h5>proxyProto: <span class="tsd-signature-type">string</span></h5></li></ul></div>
|
|
178
178
|
<h4 class="tsd-returns-title">Returns <a href="NgrokTlsTunnelBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnelBuilder</a></h4><aside class="tsd-sources">
|
|
179
179
|
<ul>
|
|
180
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
180
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L420">index.d.ts:420</a></li></ul></aside></li></ul></section>
|
|
181
181
|
<section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-class"><a id="termination" class="tsd-anchor"></a>
|
|
182
182
|
<h3 class="tsd-anchor-link"><span>termination</span><a href="#termination" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
183
183
|
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class">
|
|
@@ -194,7 +194,7 @@ bearing on tunnel behavior.</p>
|
|
|
194
194
|
<h5>keyPem: <span class="tsd-signature-type">Uint8Array</span></h5></li></ul></div>
|
|
195
195
|
<h4 class="tsd-returns-title">Returns <a href="NgrokTlsTunnelBuilder.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnelBuilder</a></h4><aside class="tsd-sources">
|
|
196
196
|
<ul>
|
|
197
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
197
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L404">index.d.ts:404</a></li></ul></aside></li></ul></section></section></div>
|
|
198
198
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
199
199
|
<div class="tsd-navigation settings">
|
|
200
200
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<ul class="tsd-hierarchy">
|
|
21
21
|
<li><span class="target">UpdateRequest</span></li></ul></section><aside class="tsd-sources">
|
|
22
22
|
<ul>
|
|
23
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
23
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L161">index.d.ts:161</a></li></ul></aside>
|
|
24
24
|
<section class="tsd-panel-group tsd-index-group">
|
|
25
25
|
<section class="tsd-panel tsd-index-panel">
|
|
26
26
|
<details class="tsd-index-content tsd-index-accordion" open><summary class="tsd-accordion-summary tsd-index-summary">
|
|
@@ -51,14 +51,14 @@
|
|
|
51
51
|
<div class="tsd-comment tsd-typography"><p>Whether or not updating to the same major version is sufficient.</p>
|
|
52
52
|
</div><aside class="tsd-sources">
|
|
53
53
|
<ul>
|
|
54
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
54
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L165">index.d.ts:165</a></li></ul></aside></section>
|
|
55
55
|
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class"><a id="version" class="tsd-anchor"></a>
|
|
56
56
|
<h3 class="tsd-anchor-link"><span>version</span><a href="#version" aria-label="Permalink" class="tsd-anchor-icon"><svg class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-anchor-a"></use><use href="#icon-anchor-b"></use><use href="#icon-anchor-c"></use></svg></a></h3>
|
|
57
57
|
<div class="tsd-signature">version<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
|
|
58
58
|
<div class="tsd-comment tsd-typography"><p>The version that the agent is requested to update to.</p>
|
|
59
59
|
</div><aside class="tsd-sources">
|
|
60
60
|
<ul>
|
|
61
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
61
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L163">index.d.ts:163</a></li></ul></aside></section></section></div>
|
|
62
62
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
63
63
|
<div class="tsd-navigation settings">
|
|
64
64
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -29,7 +29,7 @@ Optionally set the logging level to one of ERROR, WARN, INFO, DEBUG, or TRACE.</
|
|
|
29
29
|
<h5><code class="tsd-tag ts-flagOptional">Optional</code> level: <span class="tsd-signature-type">String</span></h5></li></ul></div>
|
|
30
30
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">any</span></h4><aside class="tsd-sources">
|
|
31
31
|
<ul>
|
|
32
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
32
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L444">index.d.ts:444</a></li></ul></aside></li></ul></section></div>
|
|
33
33
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
34
34
|
<div class="tsd-navigation settings">
|
|
35
35
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
<h5><code class="tsd-tag ts-flagOptional">Optional</code> tunnel: <a href="../classes/NgrokHttpTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokHttpTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokTcpTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTcpTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokTlsTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokLabeledTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokLabeledTunnel</a></h5></li></ul></div>
|
|
31
31
|
<h4 class="tsd-returns-title">Returns <a href="../classes/NgrokHttpTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokHttpTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokTcpTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTcpTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokTlsTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokLabeledTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokLabeledTunnel</a></h4><aside class="tsd-sources">
|
|
32
32
|
<ul>
|
|
33
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
33
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L439">index.d.ts:439</a></li></ul></aside></li></ul></section></div>
|
|
34
34
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
35
35
|
<div class="tsd-navigation settings">
|
|
36
36
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<h5><code class="tsd-tag ts-flagOptional">Optional</code> tunnel: <a href="../classes/NgrokHttpTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokHttpTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokTcpTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTcpTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokTlsTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokLabeledTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokLabeledTunnel</a></h5></li></ul></div>
|
|
29
29
|
<h4 class="tsd-returns-title">Returns <a href="../classes/NgrokHttpTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokHttpTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokTcpTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTcpTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokTlsTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokTlsTunnel</a><span class="tsd-signature-symbol"> | </span><a href="../classes/NgrokLabeledTunnel.html" class="tsd-signature-type" data-tsd-kind="Class">NgrokLabeledTunnel</a></h4><aside class="tsd-sources">
|
|
30
30
|
<ul>
|
|
31
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
31
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L437">index.d.ts:437</a></li></ul></aside></li></ul></section></div>
|
|
32
32
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
33
33
|
<div class="tsd-navigation settings">
|
|
34
34
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
@@ -47,7 +47,7 @@ The log level defaults to INFO, it can be set to one of ERROR, WARN, INFO, DEBUG
|
|
|
47
47
|
<h5><code class="tsd-tag ts-flagOptional">Optional</code> level: <span class="tsd-signature-type">string</span></h5></li></ul></div>
|
|
48
48
|
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><aside class="tsd-sources">
|
|
49
49
|
<ul>
|
|
50
|
-
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/
|
|
50
|
+
<li>Defined in <a href="https://github.com/ngrok/ngrok-js/blob/b3dca65/index.d.ts#L11">index.d.ts:11</a></li></ul></aside></li></ul></section></div>
|
|
51
51
|
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
52
52
|
<div class="tsd-navigation settings">
|
|
53
53
|
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
package/docs/index.html
CHANGED
|
@@ -20,9 +20,8 @@
|
|
|
20
20
|
<a href="https://github.com/ngrok/ngrok-rs/blob/main/LICENSE-MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT licensed"></a>
|
|
21
21
|
<a href="https://github.com/ngrok/ngrok-rs/blob/main/LICENSE-APACHE"><img src="https://img.shields.io/badge/license-Apache_2.0-blue.svg" alt="Apache-2.0 licensed"></a>
|
|
22
22
|
<a href="https://github.com/ngrok/ngrok-js/actions/workflows/ci.yml"><img src="https://github.com/ngrok/ngrok-js/actions/workflows/ci.yml/badge.svg" alt="Continuous integration"></a></p>
|
|
23
|
-
<p><a href="https://ngrok.com">Website</a></p>
|
|
24
23
|
<p><strong>Note: This is alpha-quality software. Interfaces are subject to change without warning.</strong></p>
|
|
25
|
-
<p>ngrok is a globally distributed reverse proxy commonly used for quickly getting a public URL to a
|
|
24
|
+
<p><a href="https://ngrok.com">ngrok</a> is a globally distributed reverse proxy commonly used for quickly getting a public URL to a
|
|
26
25
|
service running inside a private network, such as on your local laptop. The ngrok agent is usually
|
|
27
26
|
deployed inside a private network and is used to communicate with the ngrok cloud service.</p>
|
|
28
27
|
<p>This is the ngrok agent in library form, suitable for integrating directly into NodeJS
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const express = require('express')
|
|
2
|
+
const ngrok = require('@ngrok/ngrok')
|
|
3
|
+
const app = express()
|
|
4
|
+
|
|
5
|
+
app.get('/', (req, res) => {
|
|
6
|
+
res.send('Hello World!')
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
ngrok.listen(app).then(() => {
|
|
10
|
+
console.log("established tunnel at: " + app.tunnel.url());
|
|
11
|
+
});
|
|
@@ -6,6 +6,21 @@ app.get('/', (req, res) => {
|
|
|
6
6
|
res.send('Hello World!')
|
|
7
7
|
})
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
async function setup() {
|
|
10
|
+
// create session
|
|
11
|
+
const session = await new ngrok.NgrokSessionBuilder()
|
|
12
|
+
.authtokenFromEnv()
|
|
13
|
+
.metadata("Online in One Line")
|
|
14
|
+
.connect();
|
|
15
|
+
// create tunnel
|
|
16
|
+
const tunnel = await session.httpEndpoint()
|
|
17
|
+
.allowCidr("0.0.0.0/0")
|
|
18
|
+
.oauth("google")
|
|
19
|
+
.requestHeader("X-Req-Yup", "true")
|
|
20
|
+
.listen();
|
|
21
|
+
console.log("tunnel established at: " + tunnel.url());
|
|
22
|
+
// link tunnel to app
|
|
23
|
+
ngrok.listen(app, tunnel)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
setup();
|
|
@@ -15,12 +15,15 @@ console.log('Node.js web server at ' + UNIX_SOCKET + ' is running..');
|
|
|
15
15
|
// setup ngrok
|
|
16
16
|
var ngrok = require('@ngrok/ngrok');
|
|
17
17
|
// import ngrok from '@ngrok/ngrok' // if inside a module
|
|
18
|
-
ngrok.consoleLog(); // turn on
|
|
18
|
+
ngrok.consoleLog('INFO'); // turn on info logging
|
|
19
|
+
|
|
19
20
|
builder = new ngrok.NgrokSessionBuilder();
|
|
20
21
|
builder
|
|
21
22
|
// .authtoken("<authtoken>")
|
|
22
23
|
.authtokenFromEnv()
|
|
23
24
|
.metadata("Online in One Line")
|
|
25
|
+
// .caCert(fs.readFileSync('ca.crt'))
|
|
26
|
+
// .serverAddr('192.168.1.1:443')
|
|
24
27
|
.handleStopCommand(() => {
|
|
25
28
|
console.log("stop command");
|
|
26
29
|
})
|
|
@@ -30,6 +33,13 @@ builder
|
|
|
30
33
|
.handleUpdateCommand((update) => {
|
|
31
34
|
console.log("update command, version: " + update.version
|
|
32
35
|
+ " permitMajorVersion: " + update.permitMajorVersion);
|
|
36
|
+
})
|
|
37
|
+
.handleHeartbeat((latency) => {
|
|
38
|
+
console.log("heartbeat, latency: " + latency + " milliseconds");
|
|
39
|
+
})
|
|
40
|
+
.handleDisconnection((addr, error) => {
|
|
41
|
+
console.log("disconnected, addr: " + addr
|
|
42
|
+
+ " error: " + error);
|
|
33
43
|
});
|
|
34
44
|
|
|
35
45
|
builder.connect().then((session) => {
|
package/index.d.ts
CHANGED
|
@@ -70,6 +70,27 @@ export class NgrokSessionBuilder {
|
|
|
70
70
|
* [server_addr parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#server_addr
|
|
71
71
|
*/
|
|
72
72
|
serverAddr(addr: string): this
|
|
73
|
+
/**
|
|
74
|
+
* Configures the TLS certificate used to connect to the ngrok service while
|
|
75
|
+
* establishing the session. Use this option only if you are connecting through
|
|
76
|
+
* a man-in-the-middle or deep packet inspection proxy. Pass in the bytes of the certificate
|
|
77
|
+
* to be used to validate the connection, then override the address to connect to via
|
|
78
|
+
* the server_addr call.
|
|
79
|
+
*
|
|
80
|
+
* Roughly corresponds to the [root_cas parameter in the ngrok docs].
|
|
81
|
+
*
|
|
82
|
+
* [root_cas parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#root_cas
|
|
83
|
+
*/
|
|
84
|
+
caCert(certBytes: Uint8Array): this
|
|
85
|
+
/**
|
|
86
|
+
* Configures a function which is called to after a disconnection to the
|
|
87
|
+
* ngrok service. In the event of network disruptions, it will be called each time
|
|
88
|
+
* the session reconnects. The handler is given the address that will be used to
|
|
89
|
+
* connect the session to, e.g. "example.com:443", and the message from the error
|
|
90
|
+
* that occurred. Returning true from the handler will cause the session to
|
|
91
|
+
* reconnect, returning false will cause the Session to throw an uncaught error.
|
|
92
|
+
*/
|
|
93
|
+
handleDisconnection(handler: (addr: string, error: string) => boolean): this
|
|
73
94
|
/**
|
|
74
95
|
* Configures a function which is called when the ngrok service requests that
|
|
75
96
|
* this [Session] stops. Your application may choose to interpret this callback
|
|
@@ -111,6 +132,14 @@ export class NgrokSessionBuilder {
|
|
|
111
132
|
* callback, it will also cause the operation to time out.
|
|
112
133
|
*/
|
|
113
134
|
handleUpdateCommand(handler: (update: UpdateRequest) => void): this
|
|
135
|
+
/**
|
|
136
|
+
* Call the provided handler whenever a heartbeat response is received,
|
|
137
|
+
* with the latency in milliseconds.
|
|
138
|
+
*
|
|
139
|
+
* If the handler returns an error, the heartbeat task will exit, resulting
|
|
140
|
+
* in the session eventually dying as well.
|
|
141
|
+
*/
|
|
142
|
+
handleHeartbeat(handler: (latency: number) => void): this
|
|
114
143
|
/** Attempt to establish an ngrok session using the current configuration. */
|
|
115
144
|
connect(): Promise<NgrokSession>
|
|
116
145
|
}
|
|
@@ -126,6 +155,8 @@ export class NgrokSession {
|
|
|
126
155
|
labeledTunnel(): NgrokLabeledTunnelBuilder
|
|
127
156
|
/** Close a tunnel with the given ID. */
|
|
128
157
|
closeTunnel(id: string): Promise<void>
|
|
158
|
+
/** Close the ngrok session. */
|
|
159
|
+
close(): Promise<void>
|
|
129
160
|
}
|
|
130
161
|
export class UpdateRequest {
|
|
131
162
|
/** The version that the agent is requested to update to. */
|
package/index.js
CHANGED
|
@@ -292,6 +292,7 @@ async function ngrokBind(bind) {
|
|
|
292
292
|
const tunnel = await this._listen();
|
|
293
293
|
if (bind !== false) {
|
|
294
294
|
const socket = await randomTcpSocket();
|
|
295
|
+
tunnel.socket = socket;
|
|
295
296
|
defineTunnelHandle(tunnel, socket);
|
|
296
297
|
}
|
|
297
298
|
return tunnel;
|
|
@@ -342,12 +343,18 @@ async function defaultTunnel(bind) {
|
|
|
342
343
|
}
|
|
343
344
|
|
|
344
345
|
// Get a listenable ngrok tunnel, suitable for passing to net.Server.listen().
|
|
346
|
+
// Uses the NGROK_AUTHTOKEN environment variable to authenticate.
|
|
345
347
|
async function listenable() {
|
|
346
348
|
return await defaultTunnel();
|
|
347
349
|
}
|
|
348
350
|
|
|
349
|
-
// Bind a server to a ngrok tunnel, optionally passing in a pre-existing tunnel
|
|
351
|
+
// Bind a server to a new ngrok tunnel, optionally passing in a pre-existing tunnel instead.
|
|
352
|
+
// Uses the NGROK_AUTHTOKEN environment variable to authenticate if a new tunnel is created.
|
|
350
353
|
async function ngrokListen(server, tunnel) {
|
|
354
|
+
if (tunnel && tunnel.socket) {
|
|
355
|
+
// close the default bound port
|
|
356
|
+
tunnel.socket.close();
|
|
357
|
+
}
|
|
351
358
|
if (!tunnel) {
|
|
352
359
|
// turn off automatic bind
|
|
353
360
|
tunnel = await defaultTunnel(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrok/ngrok",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"napi": {
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
"ava": "^4.3.3",
|
|
29
29
|
"axios": "^1.3.3",
|
|
30
30
|
"express": "^4.18.2",
|
|
31
|
-
"segfault-handler": "^1.3.0",
|
|
32
31
|
"ts-node": "^10.9.1",
|
|
33
32
|
"typedoc": "^0.23.26",
|
|
34
33
|
"typescript": "^4.9.5",
|
|
@@ -55,19 +54,19 @@
|
|
|
55
54
|
"description": "The ngrok agent in library form, suitable for integrating directly into your NodeJS application.",
|
|
56
55
|
"repository": "https://github.com/ngrok/ngrok-js",
|
|
57
56
|
"optionalDependencies": {
|
|
58
|
-
"@ngrok/ngrok-win32-x64-msvc": "0.0
|
|
59
|
-
"@ngrok/ngrok-darwin-x64": "0.0
|
|
60
|
-
"@ngrok/ngrok-linux-x64-gnu": "0.0
|
|
61
|
-
"@ngrok/ngrok-darwin-arm64": "0.0
|
|
62
|
-
"@ngrok/ngrok-android-arm64": "0.0
|
|
63
|
-
"@ngrok/ngrok-linux-arm64-gnu": "0.0
|
|
64
|
-
"@ngrok/ngrok-linux-arm64-musl": "0.0
|
|
65
|
-
"@ngrok/ngrok-win32-arm64-msvc": "0.0
|
|
66
|
-
"@ngrok/ngrok-linux-arm-gnueabihf": "0.0
|
|
67
|
-
"@ngrok/ngrok-linux-x64-musl": "0.0
|
|
68
|
-
"@ngrok/ngrok-freebsd-x64": "0.0
|
|
69
|
-
"@ngrok/ngrok-win32-ia32-msvc": "0.0
|
|
70
|
-
"@ngrok/ngrok-android-arm-eabi": "0.0
|
|
71
|
-
"@ngrok/ngrok-darwin-universal": "0.0
|
|
57
|
+
"@ngrok/ngrok-win32-x64-msvc": "0.1.0",
|
|
58
|
+
"@ngrok/ngrok-darwin-x64": "0.1.0",
|
|
59
|
+
"@ngrok/ngrok-linux-x64-gnu": "0.1.0",
|
|
60
|
+
"@ngrok/ngrok-darwin-arm64": "0.1.0",
|
|
61
|
+
"@ngrok/ngrok-android-arm64": "0.1.0",
|
|
62
|
+
"@ngrok/ngrok-linux-arm64-gnu": "0.1.0",
|
|
63
|
+
"@ngrok/ngrok-linux-arm64-musl": "0.1.0",
|
|
64
|
+
"@ngrok/ngrok-win32-arm64-msvc": "0.1.0",
|
|
65
|
+
"@ngrok/ngrok-linux-arm-gnueabihf": "0.1.0",
|
|
66
|
+
"@ngrok/ngrok-linux-x64-musl": "0.1.0",
|
|
67
|
+
"@ngrok/ngrok-freebsd-x64": "0.1.0",
|
|
68
|
+
"@ngrok/ngrok-win32-ia32-msvc": "0.1.0",
|
|
69
|
+
"@ngrok/ngrok-android-arm-eabi": "0.1.0",
|
|
70
|
+
"@ngrok/ngrok-darwin-universal": "0.1.0"
|
|
72
71
|
}
|
|
73
72
|
}
|