@ngrok/ngrok 0.4.1 → 0.5.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 +11 -2
- package/CONTRIBUTING.md +4 -4
- package/Cargo.toml +3 -3
- package/README.md +29 -29
- package/docs/assets/search.js +1 -1
- package/docs/classes/NgrokHttpTunnelBuilder.html +21 -21
- package/docs/classes/NgrokLabeledTunnelBuilder.html +4 -4
- package/docs/classes/NgrokSession.html +7 -7
- package/docs/classes/NgrokSessionBuilder.html +40 -15
- package/docs/classes/NgrokTcpTunnelBuilder.html +8 -8
- package/docs/classes/NgrokTlsTunnelBuilder.html +10 -10
- package/docs/classes/NgrokTunnel.html +10 -10
- package/docs/classes/UpdateRequest.html +3 -3
- package/docs/functions/authtoken.html +1 -1
- package/docs/functions/connect.html +1 -1
- package/docs/functions/consoleLog.html +3 -3
- package/docs/functions/disconnect.html +1 -1
- package/docs/functions/kill.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 +28 -28
- package/docs/interfaces/Config.html +53 -53
- package/examples/ngrok-http-full.js +1 -0
- package/flake.nix +1 -1
- package/index.d.ts +13 -1
- package/package.json +15 -15
- package/src/session.rs +27 -4
- package/trailer.d.ts +1 -1
package/docs/index.html
CHANGED
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
<div class="tsd-page-title">
|
|
14
14
|
<h2>@ngrok/ngrok</h2></div>
|
|
15
15
|
<div class="tsd-panel tsd-typography"><a id="md:the-ngrok-agent-sdk-for-nodejs" class="tsd-anchor"></a><h1><a href="#md:the-ngrok-agent-sdk-for-nodejs">The ngrok Agent SDK for NodeJS</a></h1><p><a href="https://www.npmjs.com/package/@ngrok/ngrok"><img src="https://img.shields.io/npm/v/@ngrok/ngrok.svg" alt="npm.rs"></a>
|
|
16
|
-
<a href="https://github.com/ngrok/ngrok-
|
|
17
|
-
<a href="https://github.com/ngrok/ngrok-
|
|
18
|
-
<a href="https://github.com/ngrok/ngrok-
|
|
16
|
+
<a href="https://github.com/ngrok/ngrok-rust/blob/main/LICENSE-MIT"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT licensed"></a>
|
|
17
|
+
<a href="https://github.com/ngrok/ngrok-rust/blob/main/LICENSE-APACHE"><img src="https://img.shields.io/badge/license-Apache_2.0-blue.svg" alt="Apache-2.0 licensed"></a>
|
|
18
|
+
<a href="https://github.com/ngrok/ngrok-nodejs/actions/workflows/ci.yml"><img src="https://github.com/ngrok/ngrok-nodejs/actions/workflows/ci.yml/badge.svg" alt="Continuous integration"></a></p>
|
|
19
19
|
<p><strong>Note: This is beta-quality software. Interfaces may change without warning.</strong></p>
|
|
20
20
|
<p><a href="https://ngrok.com">ngrok</a> is a globally distributed reverse proxy commonly used for quickly getting a public URL to a
|
|
21
21
|
service running inside a private network, such as on your local laptop. The ngrok agent is usually
|
|
@@ -27,42 +27,42 @@ to manage.</p>
|
|
|
27
27
|
<a href="https://www.npmjs.com/package/@ngrok/ngrok">npm</a>.</p>
|
|
28
28
|
<pre><code class="language-shell"><span class="hl-0">npm </span><span class="hl-1">install</span><span class="hl-0"> </span><span class="hl-1">@ngrok/ngrok</span>
|
|
29
29
|
</code><button>Copy</button></pre>
|
|
30
|
-
<a id="md:documentation" class="tsd-anchor"></a><h1><a href="#md:documentation">Documentation</a></h1><p>A quickstart guide and a full API reference are included in the <a href="https://ngrok.github.io/ngrok-
|
|
30
|
+
<a id="md:documentation" class="tsd-anchor"></a><h1><a href="#md:documentation">Documentation</a></h1><p>A quickstart guide and a full API reference are included in the <a href="https://ngrok.github.io/ngrok-nodejs/">ngrok-nodejs API documentation</a>.</p>
|
|
31
31
|
<a id="md:quickstart" class="tsd-anchor"></a><h1><a href="#md:quickstart">Quickstart</a></h1><p>After you've installed the package, you'll need an Auth Token. Retrieve one on the
|
|
32
32
|
<a href="https://dashboard.ngrok.com/get-started/your-authtoken">Auth Token page of your ngrok dashboard</a></p>
|
|
33
|
-
<p>There are multiple examples in <a href="https://github.com/ngrok/ngrok-
|
|
34
|
-
A minimal use-case looks like <a href="https://github.com/ngrok/ngrok-
|
|
33
|
+
<p>There are multiple examples in <a href="https://github.com/ngrok/ngrok-nodejs/tree/main/examples">the /examples directory</a>.
|
|
34
|
+
A minimal use-case looks like <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-http-minimum.js">the following</a>:</p>
|
|
35
35
|
<pre><code class="language-jsx"><span class="hl-2">var</span><span class="hl-0"> </span><span class="hl-3">ngrok</span><span class="hl-0"> = </span><span class="hl-4">require</span><span class="hl-0">(</span><span class="hl-1">"@ngrok/ngrok"</span><span class="hl-0">);</span><br/><br/><span class="hl-2">async</span><span class="hl-0"> </span><span class="hl-2">function</span><span class="hl-0"> </span><span class="hl-4">create_tunnel</span><span class="hl-0">() {</span><br/><span class="hl-0"> </span><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-5">session</span><span class="hl-0"> = </span><span class="hl-6">await</span><span class="hl-0"> </span><span class="hl-2">new</span><span class="hl-0"> </span><span class="hl-3">ngrok</span><span class="hl-0">.</span><span class="hl-4">NgrokSessionBuilder</span><span class="hl-0">().</span><span class="hl-4">authtokenFromEnv</span><span class="hl-0">().</span><span class="hl-4">connect</span><span class="hl-0">();</span><br/><span class="hl-0"> </span><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-5">tunnel</span><span class="hl-0"> = </span><span class="hl-6">await</span><span class="hl-0"> </span><span class="hl-3">session</span><span class="hl-0">.</span><span class="hl-4">httpEndpoint</span><span class="hl-0">().</span><span class="hl-4">listen</span><span class="hl-0">();</span><br/><span class="hl-0"> </span><span class="hl-3">console</span><span class="hl-0">.</span><span class="hl-4">log</span><span class="hl-0">(</span><span class="hl-1">"Ingress established at:"</span><span class="hl-0">, </span><span class="hl-3">tunnel</span><span class="hl-0">.</span><span class="hl-4">url</span><span class="hl-0">());</span><br/><span class="hl-0"> </span><span class="hl-3">tunnel</span><span class="hl-0">.</span><span class="hl-4">forwardTcp</span><span class="hl-0">(</span><span class="hl-1">"localhost:8081"</span><span class="hl-0">);</span><br/><span class="hl-0">}</span>
|
|
36
36
|
</code><button>Copy</button></pre>
|
|
37
|
-
<p>or <a href="https://github.com/ngrok/ngrok-
|
|
37
|
+
<p>or <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-connect-minimal.js">with the 'connect' convenience function</a>:</p>
|
|
38
38
|
<pre><code class="language-jsx"><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-5">ngrok</span><span class="hl-0"> = </span><span class="hl-4">require</span><span class="hl-0">(</span><span class="hl-1">"@ngrok/ngrok"</span><span class="hl-0">);</span><br/><span class="hl-3">ngrok</span><span class="hl-0">.</span><span class="hl-4">connect</span><span class="hl-0">({</span><span class="hl-3">addr:</span><span class="hl-0"> </span><span class="hl-7">8080</span><span class="hl-0">, </span><span class="hl-3">authtoken_from_env:</span><span class="hl-0"> </span><span class="hl-2">true</span><span class="hl-0">}).</span><span class="hl-4">then</span><span class="hl-0">((</span><span class="hl-3">url</span><span class="hl-0">) </span><span class="hl-2">=></span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-3">console</span><span class="hl-0">.</span><span class="hl-4">log</span><span class="hl-0">(</span><span class="hl-1">`Ingress established at: </span><span class="hl-2">${</span><span class="hl-3">url</span><span class="hl-2">}</span><span class="hl-1">`</span><span class="hl-0">);</span><br/><span class="hl-0">});</span>
|
|
39
39
|
</code><button>Copy</button></pre>
|
|
40
40
|
<a id="md:examples" class="tsd-anchor"></a><h1><a href="#md:examples">Examples</a></h1><p>Degit can be used for cloning and running an example directory like this:</p>
|
|
41
|
-
<pre><code class="language-bash"><span class="hl-0">npx </span><span class="hl-1">degit</span><span class="hl-0"> </span><span class="hl-1">github:ngrok/ngrok-
|
|
41
|
+
<pre><code class="language-bash"><span class="hl-0">npx </span><span class="hl-1">degit</span><span class="hl-0"> </span><span class="hl-1">github:ngrok/ngrok-nodejs/examples/</span><span class="hl-0"><</span><span class="hl-1">exampl</span><span class="hl-0">e> <</span><span class="hl-1">folder-nam</span><span class="hl-0">e></span><br/><span class="hl-4">cd</span><span class="hl-0"> <</span><span class="hl-1">folder-nam</span><span class="hl-0">e></span><br/><span class="hl-0">npm </span><span class="hl-1">i</span>
|
|
42
42
|
</code><button>Copy</button></pre>
|
|
43
43
|
<p>For example:</p>
|
|
44
|
-
<pre><code class="language-bash"><span class="hl-0">npx </span><span class="hl-1">degit</span><span class="hl-0"> </span><span class="hl-1">github:ngrok/ngrok-
|
|
44
|
+
<pre><code class="language-bash"><span class="hl-0">npx </span><span class="hl-1">degit</span><span class="hl-0"> </span><span class="hl-1">github:ngrok/ngrok-nodejs/examples/express</span><span class="hl-0"> </span><span class="hl-1">express</span><span class="hl-0"> && </span><span class="hl-4">cd</span><span class="hl-0"> </span><span class="hl-1">express</span><span class="hl-0"> && npm </span><span class="hl-1">i</span>
|
|
45
45
|
</code><button>Copy</button></pre>
|
|
46
46
|
<a id="md:frameworks" class="tsd-anchor"></a><h2><a href="#md:frameworks">Frameworks</a></h2><ul>
|
|
47
|
-
<li><a href="https://expressjs.com/">Express</a> - <a href="https://github.com/ngrok/ngrok-
|
|
48
|
-
<li><a href="https://www.fastify.io/">Fastify</a> - <a href="https://github.com/ngrok/ngrok-
|
|
49
|
-
<li><a href="https://hapi.dev/">Hapi</a> - <a href="https://github.com/ngrok/ngrok-
|
|
50
|
-
<li><a href="https://koajs.com/">Koa</a> - <a href="https://github.com/ngrok/ngrok-
|
|
51
|
-
<li><a href="https://nestjs.com/">Nest.js</a> - <a href="https://github.com/ngrok/ngrok-
|
|
52
|
-
<li><a href="https://nextjs.org/">Next.js</a> - <a href="https://github.com/ngrok/ngrok-
|
|
53
|
-
<li><a href="https://remix.run/">Remix</a> - <a href="https://github.com/ngrok/ngrok-
|
|
54
|
-
<li><a href="https://svelte.dev/">Svelte</a> - <a href="https://github.com/ngrok/ngrok-
|
|
55
|
-
<li><a href="https://www.typescriptlang.org/">Typescript</a> - <a href="https://github.com/ngrok/ngrok-
|
|
56
|
-
<li><a href="https://vuejs.org/">Vue</a> - <a href="https://github.com/ngrok/ngrok-
|
|
57
|
-
<li><a href="https://github.com/winstonjs/winston#readme">Winston</a> Logging - <a href="https://github.com/ngrok/ngrok-
|
|
47
|
+
<li><a href="https://expressjs.com/">Express</a> - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/express/ngrok-express-quickstart.js">Quickstart Example</a>, <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/express/ngrok-express.js">Configuration Example</a></li>
|
|
48
|
+
<li><a href="https://www.fastify.io/">Fastify</a> - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/fastify/ngrok-fastify.js">Example</a></li>
|
|
49
|
+
<li><a href="https://hapi.dev/">Hapi</a> - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/hapi/ngrok-hapi.js">Example</a></li>
|
|
50
|
+
<li><a href="https://koajs.com/">Koa</a> - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/koa/ngrok-koa.js">Example</a></li>
|
|
51
|
+
<li><a href="https://nestjs.com/">Nest.js</a> - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/nestjs/src/main.ts">Example main.ts</a></li>
|
|
52
|
+
<li><a href="https://nextjs.org/">Next.js</a> - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/nextjs/next.config.js">Example next.config.js</a> loading <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/nextjs/ngrok.config.js">ngrok.config.js</a></li>
|
|
53
|
+
<li><a href="https://remix.run/">Remix</a> - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/remix/remix.config.js">Example remix.config.js</a> loading <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/remix/ngrok.config.js">ngrok.config.js</a></li>
|
|
54
|
+
<li><a href="https://svelte.dev/">Svelte</a> - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/svelte/svelte.config.js">Example svelte.config.js</a> (works in vite.config.js too) loading <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/svelte/ngrok.config.cjs">ngrok.config.cjs</a></li>
|
|
55
|
+
<li><a href="https://www.typescriptlang.org/">Typescript</a> - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-typescript.ts">Example ts-node</a></li>
|
|
56
|
+
<li><a href="https://vuejs.org/">Vue</a> - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/vue/vite.config.ts">Example vite.config.ts</a> loading <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/vue/ngrok.config.ts">ngrok.config.ts</a></li>
|
|
57
|
+
<li><a href="https://github.com/winstonjs/winston#readme">Winston</a> Logging - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-winston.js">Example</a></li>
|
|
58
58
|
</ul>
|
|
59
59
|
<a id="md:tunnel-types" class="tsd-anchor"></a><h2><a href="#md:tunnel-types">Tunnel Types</a></h2><ul>
|
|
60
|
-
<li>ngrok.connect - <a href="https://github.com/ngrok/ngrok-
|
|
61
|
-
<li>HTTP - <a href="https://github.com/ngrok/ngrok-
|
|
62
|
-
<li>Labeled - <a href="https://github.com/ngrok/ngrok-
|
|
63
|
-
<li>TCP - <a href="https://github.com/ngrok/ngrok-
|
|
64
|
-
<li>TLS - <a href="https://github.com/ngrok/ngrok-
|
|
65
|
-
<li>Windows Pipe - <a href="https://github.com/ngrok/ngrok-
|
|
60
|
+
<li>ngrok.connect - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-connect-minimal.js">ngrok.connect Minimal Example</a>, <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-connect-full.js">Full ngrok.connect Example</a></li>
|
|
61
|
+
<li>HTTP - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-listen.js">ngrok.listen Example</a>, <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-http-minimum.js">Minimal Example</a>, <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-http-full.js">Full Configuration Example</a></li>
|
|
62
|
+
<li>Labeled - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-labeled.js">Example</a></li>
|
|
63
|
+
<li>TCP - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-tcp.js">Example</a></li>
|
|
64
|
+
<li>TLS - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-tls.js">Example</a></li>
|
|
65
|
+
<li>Windows Pipe - <a href="https://github.com/ngrok/ngrok-nodejs/blob/main/examples/ngrok-windows-pipe.js">Example</a></li>
|
|
66
66
|
</ul>
|
|
67
67
|
<a id="md:async-programming" class="tsd-anchor"></a><h1><a href="#md:async-programming">Async Programming</a></h1><p>All methods return a <code>Promise</code> and are suitable for use in asynchronous
|
|
68
68
|
programming. You can use callback chaining with <code>.then()</code> and <code>.catch()</code> syntax
|
|
@@ -125,7 +125,7 @@ which can be caught and dealt with using standard then/catch semantics.</p>
|
|
|
125
125
|
<td>✓</td>
|
|
126
126
|
</tr>
|
|
127
127
|
</tbody></table>
|
|
128
|
-
<p>ngrok-
|
|
128
|
+
<p>ngrok-nodejs, and <a href="https://github.com/ngrok/ngrok-rust/">ngrok-rust</a> which it depends on, are open source, so it may be possible to build them for other platforms.</p>
|
|
129
129
|
<ul>
|
|
130
130
|
<li>Windows-aarch64 will be supported after the next release of <a href="https://github.com/briansmith/ring/issues/1167">Ring</a>.</li>
|
|
131
131
|
</ul>
|
|
@@ -139,7 +139,7 @@ which can be caught and dealt with using standard then/catch semantics.</p>
|
|
|
139
139
|
</ul>
|
|
140
140
|
<p>at your option.</p>
|
|
141
141
|
<a id="md:contribution" class="tsd-anchor"></a><h3><a href="#md:contribution">Contribution</a></h3><p>Unless you explicitly state otherwise, any contribution intentionally submitted
|
|
142
|
-
for inclusion in
|
|
142
|
+
for inclusion in ngrok-nodejs by you, as defined in the Apache-2.0 license, shall be
|
|
143
143
|
dual licensed as above, without any additional terms or conditions.</p>
|
|
144
144
|
</div></div>
|
|
145
145
|
<div class="col-sidebar">
|