@ngrok/ngrok 0.0.7 → 0.0.8
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 +16 -0
- package/CONTRIBUTING.md +4 -4
- package/Cargo.toml +4 -2
- package/README.md +5 -1
- package/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +71 -0
- package/docs/assets/main.js +58 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1280 -0
- package/docs/classes/NgrokHttpTunnel.html +189 -0
- package/docs/classes/NgrokHttpTunnelBuilder.html +440 -0
- package/docs/classes/NgrokLabeledTunnel.html +177 -0
- package/docs/classes/NgrokLabeledTunnelBuilder.html +130 -0
- package/docs/classes/NgrokSession.html +142 -0
- package/docs/classes/NgrokSessionBuilder.html +303 -0
- package/docs/classes/NgrokTcpTunnel.html +189 -0
- package/docs/classes/NgrokTcpTunnelBuilder.html +199 -0
- package/docs/classes/NgrokTlsTunnel.html +189 -0
- package/docs/classes/NgrokTlsTunnelBuilder.html +235 -0
- package/docs/classes/UpdateRequest.html +92 -0
- package/docs/functions/consoleLog.html +73 -0
- package/docs/functions/listen.html +74 -0
- package/docs/functions/listenable.html +72 -0
- package/docs/functions/loggingCallback.html +91 -0
- package/docs/index.html +129 -0
- package/docs/modules.html +79 -0
- package/examples/ngrok-http-full.js +2 -1
- package/examples/ngrok-typescript.ts +29 -8
- package/examples/ngrok-winston.js +24 -0
- package/index.d.ts +91 -23
- package/index.js +108 -23
- package/package.json +20 -16
- package/scripts/gc-node-drop.js +6 -2
- package/scripts/gc-rust-drop.js +8 -4
- package/src/http.rs +64 -42
- package/src/lib.rs +1 -0
- package/src/logging.rs +134 -0
- package/src/session.rs +75 -85
- package/src/tcp.rs +2 -1
- package/src/tls.rs +6 -4
- package/src/tunnel.rs +89 -34
- package/src/tunnel_builder.rs +27 -15
- package/trailer.d.ts +9 -2
- package/trailer.js +106 -21
- package/examples/ngrok-get-socket.js +0 -12
package/docs/index.html
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@ngrok/ngrok</title><meta name="description" content="Documentation for @ngrok/ngrok"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
|
|
2
|
+
<div class="tsd-toolbar-contents container">
|
|
3
|
+
<div class="table-cell" id="tsd-search" data-base=".">
|
|
4
|
+
<div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
|
|
5
|
+
<div class="field">
|
|
6
|
+
<div id="tsd-toolbar-links"></div></div>
|
|
7
|
+
<ul class="results">
|
|
8
|
+
<li class="state loading">Preparing search index...</li>
|
|
9
|
+
<li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">@ngrok/ngrok</a></div>
|
|
10
|
+
<div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
|
|
11
|
+
<div class="container container-main">
|
|
12
|
+
<div class="col-8 col-content">
|
|
13
|
+
<div class="tsd-page-title">
|
|
14
|
+
<h2>@ngrok/ngrok</h2></div>
|
|
15
|
+
<div class="tsd-panel tsd-typography">
|
|
16
|
+
<a href="#the-ngrok-agent-sdk-for-nodejs" id="the-ngrok-agent-sdk-for-nodejs" style="color: inherit; text-decoration: none;">
|
|
17
|
+
<h1>The ngrok Agent SDK for NodeJS</h1>
|
|
18
|
+
</a>
|
|
19
|
+
<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>
|
|
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
|
+
<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
|
+
<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
|
+
<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
|
|
26
|
+
service running inside a private network, such as on your local laptop. The ngrok agent is usually
|
|
27
|
+
deployed inside a private network and is used to communicate with the ngrok cloud service.</p>
|
|
28
|
+
<p>This is the ngrok agent in library form, suitable for integrating directly into NodeJS
|
|
29
|
+
applications. This allows you to quickly build ngrok into your application with no separate process
|
|
30
|
+
to manage.</p>
|
|
31
|
+
|
|
32
|
+
<a href="#installation" id="installation" style="color: inherit; text-decoration: none;">
|
|
33
|
+
<h1>Installation</h1>
|
|
34
|
+
</a>
|
|
35
|
+
<p>The published library is available on
|
|
36
|
+
<a href="https://www.npmjs.com/package/@ngrok/ngrok">npm</a>.</p>
|
|
37
|
+
<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>
|
|
38
|
+
</code></pre>
|
|
39
|
+
|
|
40
|
+
<a href="#quickstart" id="quickstart" style="color: inherit; text-decoration: none;">
|
|
41
|
+
<h1>Quickstart</h1>
|
|
42
|
+
</a>
|
|
43
|
+
<p>After you've installed the package, you'll need an Auth Token. Retrieve one on the
|
|
44
|
+
<a href="https://dashboard.ngrok.com/get-started/your-authtoken">Auth Token page of your ngrok dashboard</a></p>
|
|
45
|
+
<p>There are multiple examples in <a href="https://github.com/ngrok/ngrok-js/tree/main/examples">the /examples directory</a>.
|
|
46
|
+
A minimal use-case looks like the following:</p>
|
|
47
|
+
<pre><code class="language-jsx"><span class="hl-2">const</span><span class="hl-0"> </span><span class="hl-3">server</span><span class="hl-0"> = </span><span class="hl-4">require</span><span class="hl-0">(</span><span class="hl-1">'http'</span><span class="hl-0">).</span><span class="hl-4">createServer</span><span class="hl-0">(</span><br/><span class="hl-0"> </span><span class="hl-2">function</span><span class="hl-0">(</span><span class="hl-5">req</span><span class="hl-0">,</span><span class="hl-5">res</span><span class="hl-0">){</span><span class="hl-5">res</span><span class="hl-0">.</span><span class="hl-4">writeHead</span><span class="hl-0">(</span><span class="hl-6">200</span><span class="hl-0">);</span><br/><span class="hl-0"> </span><span class="hl-5">res</span><span class="hl-0">.</span><span class="hl-4">write</span><span class="hl-0">(</span><span class="hl-1">'Hello'</span><span class="hl-0">);</span><br/><span class="hl-0"> </span><span class="hl-5">res</span><span class="hl-0">.</span><span class="hl-4">end</span><span class="hl-0">();</span><br/><span class="hl-0">} );</span><br/><br/><span class="hl-2">var</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/><br/><span class="hl-5">ngrok</span><span class="hl-0">.</span><span class="hl-4">listen</span><span class="hl-0">(</span><span class="hl-5">server</span><span class="hl-0">).</span><span class="hl-4">then</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-5">console</span><span class="hl-0">.</span><span class="hl-4">log</span><span class="hl-0">(</span><span class="hl-1">"url: "</span><span class="hl-0"> + </span><span class="hl-5">server</span><span class="hl-0">.</span><span class="hl-5">tunnel</span><span class="hl-0">.</span><span class="hl-4">url</span><span class="hl-0">());</span><br/><span class="hl-0">});</span>
|
|
48
|
+
</code></pre>
|
|
49
|
+
|
|
50
|
+
<a href="#async-programming" id="async-programming" style="color: inherit; text-decoration: none;">
|
|
51
|
+
<h3>Async Programming</h3>
|
|
52
|
+
</a>
|
|
53
|
+
<p>All methods return a <code>Promise</code> and are suitable for use in asynchronous
|
|
54
|
+
programming. You can use callback chaining with <code>.then()</code> and <code>.catch()</code> syntax
|
|
55
|
+
or the <code>await</code> keyword to wait for completion of an API call.</p>
|
|
56
|
+
|
|
57
|
+
<a href="#error-handling" id="error-handling" style="color: inherit; text-decoration: none;">
|
|
58
|
+
<h3>Error Handling</h3>
|
|
59
|
+
</a>
|
|
60
|
+
<p>The asynchronous functions will throw an error on failure to set up a session or tunnel,
|
|
61
|
+
which can be caught and dealt with using standard then/catch semantics.</p>
|
|
62
|
+
<pre><code class="language-jsx"><span class="hl-2">new</span><span class="hl-0"> </span><span class="hl-5">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-4">then</span><span class="hl-0">((</span><span class="hl-5">session</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-5">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-4">then</span><span class="hl-0">((</span><span class="hl-5">tun</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-4">catch</span><span class="hl-0">(</span><span class="hl-5">err</span><span class="hl-0"> </span><span class="hl-2">=></span><span class="hl-0"> </span><span class="hl-5">console</span><span class="hl-0">.</span><span class="hl-4">log</span><span class="hl-0">(</span><span class="hl-1">'tunnel setup error: '</span><span class="hl-0"> + </span><span class="hl-5">err</span><span class="hl-0">))</span><br/><span class="hl-0"> })</span><br/><span class="hl-0"> .</span><span class="hl-4">catch</span><span class="hl-0">(</span><span class="hl-5">err</span><span class="hl-0"> </span><span class="hl-2">=></span><span class="hl-0"> </span><span class="hl-5">console</span><span class="hl-0">.</span><span class="hl-4">log</span><span class="hl-0">(</span><span class="hl-1">'session setup error: '</span><span class="hl-0"> + </span><span class="hl-5">err</span><span class="hl-0">))</span><br/><span class="hl-0"> .</span><span class="hl-5">await</span><span class="hl-0">;</span>
|
|
63
|
+
</code></pre>
|
|
64
|
+
|
|
65
|
+
<a href="#dependencies" id="dependencies" style="color: inherit; text-decoration: none;">
|
|
66
|
+
<h1>Dependencies</h1>
|
|
67
|
+
</a>
|
|
68
|
+
<p>This project relies on <a href="https://napi.rs/">NAPI-RS</a>, an excellent system to ease development and building of Rust plugins for NodeJS.</p>
|
|
69
|
+
|
|
70
|
+
<a href="#license" id="license" style="color: inherit; text-decoration: none;">
|
|
71
|
+
<h1>License</h1>
|
|
72
|
+
</a>
|
|
73
|
+
<p>This project is licensed under either of</p>
|
|
74
|
+
<ul>
|
|
75
|
+
<li>Apache License, Version 2.0, (<a href="LICENSE-APACHE">LICENSE-APACHE</a> or
|
|
76
|
+
<a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
|
|
77
|
+
<li>MIT license (<a href="LICENSE-MIT">LICENSE-MIT</a> or
|
|
78
|
+
<a href="http://opensource.org/licenses/MIT">http://opensource.org/licenses/MIT</a>)</li>
|
|
79
|
+
</ul>
|
|
80
|
+
<p>at your option.</p>
|
|
81
|
+
|
|
82
|
+
<a href="#contribution" id="contribution" style="color: inherit; text-decoration: none;">
|
|
83
|
+
<h3>Contribution</h3>
|
|
84
|
+
</a>
|
|
85
|
+
<p>Unless you explicitly state otherwise, any contribution intentionally submitted
|
|
86
|
+
for inclusion in tokio-core by you, as defined in the Apache-2.0 license, shall be
|
|
87
|
+
dual licensed as above, without any additional terms or conditions.</p>
|
|
88
|
+
</div></div>
|
|
89
|
+
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
90
|
+
<div class="tsd-navigation settings">
|
|
91
|
+
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
92
|
+
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Settings</h3></summary>
|
|
93
|
+
<div class="tsd-accordion-details">
|
|
94
|
+
<div class="tsd-filter-visibility">
|
|
95
|
+
<h4 class="uppercase">Member Visibility</h4><form>
|
|
96
|
+
<ul id="tsd-filter-options">
|
|
97
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li>
|
|
98
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li>
|
|
99
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li>
|
|
100
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div>
|
|
101
|
+
<div class="tsd-theme-toggle">
|
|
102
|
+
<h4 class="uppercase">Theme</h4><select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div>
|
|
103
|
+
<nav class="tsd-navigation primary">
|
|
104
|
+
<details class="tsd-index-accordion" open><summary class="tsd-accordion-summary">
|
|
105
|
+
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Modules</h3></summary>
|
|
106
|
+
<div class="tsd-accordion-details">
|
|
107
|
+
<ul>
|
|
108
|
+
<li class="current selected"><a href="modules.html">@ngrok/ngrok</a>
|
|
109
|
+
<ul></ul></li></ul></div></details></nav>
|
|
110
|
+
<nav class="tsd-navigation secondary menu-sticky">
|
|
111
|
+
<ul>
|
|
112
|
+
<li class="tsd-kind-class"><a href="classes/NgrokHttpTunnel.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-128-path"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)" id="icon-128-text"></path></svg>Ngrok<wbr/>Http<wbr/>Tunnel</a></li>
|
|
113
|
+
<li class="tsd-kind-class"><a href="classes/NgrokHttpTunnelBuilder.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Http<wbr/>Tunnel<wbr/>Builder</a></li>
|
|
114
|
+
<li class="tsd-kind-class"><a href="classes/NgrokLabeledTunnel.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Labeled<wbr/>Tunnel</a></li>
|
|
115
|
+
<li class="tsd-kind-class"><a href="classes/NgrokLabeledTunnelBuilder.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Labeled<wbr/>Tunnel<wbr/>Builder</a></li>
|
|
116
|
+
<li class="tsd-kind-class"><a href="classes/NgrokSession.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Session</a></li>
|
|
117
|
+
<li class="tsd-kind-class"><a href="classes/NgrokSessionBuilder.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Session<wbr/>Builder</a></li>
|
|
118
|
+
<li class="tsd-kind-class"><a href="classes/NgrokTcpTunnel.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Tcp<wbr/>Tunnel</a></li>
|
|
119
|
+
<li class="tsd-kind-class"><a href="classes/NgrokTcpTunnelBuilder.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Tcp<wbr/>Tunnel<wbr/>Builder</a></li>
|
|
120
|
+
<li class="tsd-kind-class"><a href="classes/NgrokTlsTunnel.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Tls<wbr/>Tunnel</a></li>
|
|
121
|
+
<li class="tsd-kind-class"><a href="classes/NgrokTlsTunnelBuilder.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Tls<wbr/>Tunnel<wbr/>Builder</a></li>
|
|
122
|
+
<li class="tsd-kind-class"><a href="classes/UpdateRequest.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Update<wbr/>Request</a></li>
|
|
123
|
+
<li class="tsd-kind-function"><a href="functions/consoleLog.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-64-path"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)" id="icon-64-text"></path></svg>console<wbr/>Log</a></li>
|
|
124
|
+
<li class="tsd-kind-function"><a href="functions/listen.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>listen</a></li>
|
|
125
|
+
<li class="tsd-kind-function"><a href="functions/listenable.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>listenable</a></li>
|
|
126
|
+
<li class="tsd-kind-function"><a href="functions/loggingCallback.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>logging<wbr/>Callback</a></li></ul></nav></div></div>
|
|
127
|
+
<div class="container tsd-generator">
|
|
128
|
+
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
|
|
129
|
+
<div class="overlay"></div><script src="assets/main.js"></script></body></html>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>@ngrok/ngrok</title><meta name="description" content="Documentation for @ngrok/ngrok"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
|
|
2
|
+
<div class="tsd-toolbar-contents container">
|
|
3
|
+
<div class="table-cell" id="tsd-search" data-base=".">
|
|
4
|
+
<div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
|
|
5
|
+
<div class="field">
|
|
6
|
+
<div id="tsd-toolbar-links"></div></div>
|
|
7
|
+
<ul class="results">
|
|
8
|
+
<li class="state loading">Preparing search index...</li>
|
|
9
|
+
<li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">@ngrok/ngrok</a></div>
|
|
10
|
+
<div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
|
|
11
|
+
<div class="container container-main">
|
|
12
|
+
<div class="col-8 col-content">
|
|
13
|
+
<div class="tsd-page-title">
|
|
14
|
+
<h2>@ngrok/ngrok</h2></div>
|
|
15
|
+
<section class="tsd-panel-group tsd-index-group">
|
|
16
|
+
<section class="tsd-panel tsd-index-panel">
|
|
17
|
+
<h3 class="tsd-index-heading uppercase">Index</h3>
|
|
18
|
+
<section class="tsd-index-section">
|
|
19
|
+
<h3 class="tsd-index-heading">Classes</h3>
|
|
20
|
+
<div class="tsd-index-list"><a href="classes/NgrokHttpTunnel.html" class="tsd-index-link tsd-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-128-path"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)" id="icon-128-text"></path></svg><span>Ngrok<wbr/>Http<wbr/>Tunnel</span></a>
|
|
21
|
+
<a href="classes/NgrokHttpTunnelBuilder.html" class="tsd-index-link tsd-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Ngrok<wbr/>Http<wbr/>Tunnel<wbr/>Builder</span></a>
|
|
22
|
+
<a href="classes/NgrokLabeledTunnel.html" class="tsd-index-link tsd-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Ngrok<wbr/>Labeled<wbr/>Tunnel</span></a>
|
|
23
|
+
<a href="classes/NgrokLabeledTunnelBuilder.html" class="tsd-index-link tsd-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Ngrok<wbr/>Labeled<wbr/>Tunnel<wbr/>Builder</span></a>
|
|
24
|
+
<a href="classes/NgrokSession.html" class="tsd-index-link tsd-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Ngrok<wbr/>Session</span></a>
|
|
25
|
+
<a href="classes/NgrokSessionBuilder.html" class="tsd-index-link tsd-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Ngrok<wbr/>Session<wbr/>Builder</span></a>
|
|
26
|
+
<a href="classes/NgrokTcpTunnel.html" class="tsd-index-link tsd-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Ngrok<wbr/>Tcp<wbr/>Tunnel</span></a>
|
|
27
|
+
<a href="classes/NgrokTcpTunnelBuilder.html" class="tsd-index-link tsd-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Ngrok<wbr/>Tcp<wbr/>Tunnel<wbr/>Builder</span></a>
|
|
28
|
+
<a href="classes/NgrokTlsTunnel.html" class="tsd-index-link tsd-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Ngrok<wbr/>Tls<wbr/>Tunnel</span></a>
|
|
29
|
+
<a href="classes/NgrokTlsTunnelBuilder.html" class="tsd-index-link tsd-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Ngrok<wbr/>Tls<wbr/>Tunnel<wbr/>Builder</span></a>
|
|
30
|
+
<a href="classes/UpdateRequest.html" class="tsd-index-link tsd-kind-class"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg><span>Update<wbr/>Request</span></a>
|
|
31
|
+
</div></section>
|
|
32
|
+
<section class="tsd-index-section">
|
|
33
|
+
<h3 class="tsd-index-heading">Functions</h3>
|
|
34
|
+
<div class="tsd-index-list"><a href="functions/consoleLog.html" class="tsd-index-link tsd-kind-function"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-function)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-64-path"></rect><path d="M9.39 16V7.24H14.55V8.224H10.446V11.128H14.238V12.112H10.47V16H9.39Z" fill="var(--color-text)" id="icon-64-text"></path></svg><span>console<wbr/>Log</span></a>
|
|
35
|
+
<a href="functions/listen.html" class="tsd-index-link tsd-kind-function"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg><span>listen</span></a>
|
|
36
|
+
<a href="functions/listenable.html" class="tsd-index-link tsd-kind-function"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg><span>listenable</span></a>
|
|
37
|
+
<a href="functions/loggingCallback.html" class="tsd-index-link tsd-kind-function"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg><span>logging<wbr/>Callback</span></a>
|
|
38
|
+
</div></section></section></section></div>
|
|
39
|
+
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
|
|
40
|
+
<div class="tsd-navigation settings">
|
|
41
|
+
<details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
|
|
42
|
+
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Settings</h3></summary>
|
|
43
|
+
<div class="tsd-accordion-details">
|
|
44
|
+
<div class="tsd-filter-visibility">
|
|
45
|
+
<h4 class="uppercase">Member Visibility</h4><form>
|
|
46
|
+
<ul id="tsd-filter-options">
|
|
47
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li>
|
|
48
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-private" name="private"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Private</span></label></li>
|
|
49
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li>
|
|
50
|
+
<li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></form></div>
|
|
51
|
+
<div class="tsd-theme-toggle">
|
|
52
|
+
<h4 class="uppercase">Theme</h4><select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div>
|
|
53
|
+
<nav class="tsd-navigation primary">
|
|
54
|
+
<details class="tsd-index-accordion" open><summary class="tsd-accordion-summary">
|
|
55
|
+
<h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Modules</h3></summary>
|
|
56
|
+
<div class="tsd-accordion-details">
|
|
57
|
+
<ul>
|
|
58
|
+
<li class="current selected"><a href="modules.html">@ngrok/ngrok</a>
|
|
59
|
+
<ul></ul></li></ul></div></details></nav>
|
|
60
|
+
<nav class="tsd-navigation secondary menu-sticky">
|
|
61
|
+
<ul>
|
|
62
|
+
<li class="tsd-kind-class"><a href="classes/NgrokHttpTunnel.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Http<wbr/>Tunnel</a></li>
|
|
63
|
+
<li class="tsd-kind-class"><a href="classes/NgrokHttpTunnelBuilder.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Http<wbr/>Tunnel<wbr/>Builder</a></li>
|
|
64
|
+
<li class="tsd-kind-class"><a href="classes/NgrokLabeledTunnel.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Labeled<wbr/>Tunnel</a></li>
|
|
65
|
+
<li class="tsd-kind-class"><a href="classes/NgrokLabeledTunnelBuilder.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Labeled<wbr/>Tunnel<wbr/>Builder</a></li>
|
|
66
|
+
<li class="tsd-kind-class"><a href="classes/NgrokSession.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Session</a></li>
|
|
67
|
+
<li class="tsd-kind-class"><a href="classes/NgrokSessionBuilder.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Session<wbr/>Builder</a></li>
|
|
68
|
+
<li class="tsd-kind-class"><a href="classes/NgrokTcpTunnel.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Tcp<wbr/>Tunnel</a></li>
|
|
69
|
+
<li class="tsd-kind-class"><a href="classes/NgrokTcpTunnelBuilder.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Tcp<wbr/>Tunnel<wbr/>Builder</a></li>
|
|
70
|
+
<li class="tsd-kind-class"><a href="classes/NgrokTlsTunnel.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Tls<wbr/>Tunnel</a></li>
|
|
71
|
+
<li class="tsd-kind-class"><a href="classes/NgrokTlsTunnelBuilder.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Ngrok<wbr/>Tls<wbr/>Tunnel<wbr/>Builder</a></li>
|
|
72
|
+
<li class="tsd-kind-class"><a href="classes/UpdateRequest.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Update<wbr/>Request</a></li>
|
|
73
|
+
<li class="tsd-kind-function"><a href="functions/consoleLog.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>console<wbr/>Log</a></li>
|
|
74
|
+
<li class="tsd-kind-function"><a href="functions/listen.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>listen</a></li>
|
|
75
|
+
<li class="tsd-kind-function"><a href="functions/listenable.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>listenable</a></li>
|
|
76
|
+
<li class="tsd-kind-function"><a href="functions/loggingCallback.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-64-path"></use><use href="#icon-64-text"></use></svg>logging<wbr/>Callback</a></li></ul></nav></div></div>
|
|
77
|
+
<div class="container tsd-generator">
|
|
78
|
+
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
|
|
79
|
+
<div class="overlay"></div><script src="assets/main.js"></script></body></html>
|
|
@@ -15,6 +15,7 @@ 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 debug logging
|
|
18
19
|
builder = new ngrok.NgrokSessionBuilder();
|
|
19
20
|
builder
|
|
20
21
|
// .authtoken("<authtoken>")
|
|
@@ -49,7 +50,7 @@ builder.connect().then((session) => {
|
|
|
49
50
|
// .responseHeader("X-Res-Yup", "true")
|
|
50
51
|
// .scheme("HTTPS")
|
|
51
52
|
// .websocketTcpConversion()
|
|
52
|
-
// .webhookVerification("twilio", "asdf")
|
|
53
|
+
// .webhookVerification("twilio", "asdf")
|
|
53
54
|
.metadata("example tunnel metadata from nodejs")
|
|
54
55
|
.listen().then((tunnel) => {
|
|
55
56
|
console.log("established tunnel at: " + tunnel.url())
|
|
@@ -5,24 +5,41 @@ const httpServer = http.createServer(
|
|
|
5
5
|
function(req,res){res.writeHead(200);
|
|
6
6
|
res.write('Hello');
|
|
7
7
|
res.end();
|
|
8
|
-
} )
|
|
9
|
-
.listen(8081);
|
|
8
|
+
} );
|
|
10
9
|
|
|
11
10
|
import * as ngrok from "../index";
|
|
11
|
+
ngrok.consoleLog();
|
|
12
12
|
|
|
13
13
|
const run = async (): Promise<void> => {
|
|
14
|
-
|
|
14
|
+
// await listenServer();
|
|
15
|
+
// await listenable();
|
|
16
|
+
// await listen();
|
|
17
|
+
await standardConfig();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async function listenServer() {
|
|
15
21
|
const tunnel = await ngrok.listen(httpServer);
|
|
16
22
|
if ( typeof tunnel['url'] === 'function') {
|
|
17
23
|
console.log("tunnel at: " + tunnel['url']());
|
|
18
24
|
}
|
|
19
|
-
|
|
25
|
+
}
|
|
20
26
|
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
httpServer.listen(
|
|
24
|
-
|
|
27
|
+
async function listenable() {
|
|
28
|
+
const tunnel = await ngrok.listenable();
|
|
29
|
+
httpServer.listen(tunnel);
|
|
30
|
+
}
|
|
25
31
|
|
|
32
|
+
async function listen() {
|
|
33
|
+
const sessionBuilder = new ngrok.NgrokSessionBuilder().authtokenFromEnv()
|
|
34
|
+
const session = await sessionBuilder.connect();
|
|
35
|
+
const tunnel = await session.httpEndpoint().listen();
|
|
36
|
+
httpServer.listen(tunnel);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function standardConfig() {
|
|
40
|
+
ngrok.loggingCallback(function(level, target, message) {
|
|
41
|
+
console.log(`${level} ${target} - ${message}`);
|
|
42
|
+
});
|
|
26
43
|
const sessionBuilder = new ngrok.NgrokSessionBuilder().authtokenFromEnv()
|
|
27
44
|
.handleStopCommand(() => {
|
|
28
45
|
console.log("stop command");
|
|
@@ -37,7 +54,11 @@ const run = async (): Promise<void> => {
|
|
|
37
54
|
const session = await sessionBuilder.connect();
|
|
38
55
|
const tunnel = await session.httpEndpoint().listen();
|
|
39
56
|
console.log('tunnel at: ' + tunnel.url());
|
|
57
|
+
httpServer.listen(8081);
|
|
40
58
|
tunnel.forwardTcp('localhost:8081');
|
|
59
|
+
|
|
60
|
+
// unregister logging callback
|
|
61
|
+
ngrok.loggingCallback();
|
|
41
62
|
}
|
|
42
63
|
|
|
43
64
|
run();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// create winston logger
|
|
2
|
+
const { createLogger, format, transports } = require('winston');
|
|
3
|
+
const logger = createLogger({
|
|
4
|
+
format: format.combine(format.timestamp(), format.json()),
|
|
5
|
+
level: 'silly',
|
|
6
|
+
transports: [new transports.Console({})],
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
// plumb ngrok logging to winston
|
|
10
|
+
var ngrok = require('@ngrok/ngrok');
|
|
11
|
+
ngrok.loggingCallback(function (level, target, message) {
|
|
12
|
+
level = level == "TRACE" ? "silly" : level.toLowerCase();
|
|
13
|
+
logger.log(level, message, {"target": target});
|
|
14
|
+
}, "TRACE");
|
|
15
|
+
|
|
16
|
+
// set up tunnel
|
|
17
|
+
const server = require('http').createServer(
|
|
18
|
+
function(req,res){res.writeHead(200);
|
|
19
|
+
res.write('Hello');
|
|
20
|
+
res.end();
|
|
21
|
+
});
|
|
22
|
+
ngrok.listen(server).then((tunnel) => {
|
|
23
|
+
console.log("url: " + tunnel.url());
|
|
24
|
+
});
|
package/index.d.ts
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
/* auto-generated by NAPI-RS */
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Register a callback function that will receive logging event information.
|
|
8
|
+
* An absent callback will unregister an existing callback function.
|
|
9
|
+
* The log level defaults to INFO, it can be set to one of ERROR, WARN, INFO, DEBUG, or TRACE.
|
|
10
10
|
*/
|
|
11
|
-
export function
|
|
11
|
+
export function loggingCallback(callback?: (level: string, target: string, message: string) => void, level?: string): void
|
|
12
12
|
/** The builder for an ngrok session. */
|
|
13
13
|
export class NgrokSessionBuilder {
|
|
14
14
|
/** Create a new session builder */
|
|
@@ -124,6 +124,7 @@ export class NgrokSession {
|
|
|
124
124
|
tlsEndpoint(): NgrokTlsTunnelBuilder
|
|
125
125
|
/** Start building a labeled tunnel. */
|
|
126
126
|
labeledTunnel(): NgrokLabeledTunnelBuilder
|
|
127
|
+
/** Close a tunnel with the given ID. */
|
|
127
128
|
closeTunnel(id: string): Promise<void>
|
|
128
129
|
}
|
|
129
130
|
export class UpdateRequest {
|
|
@@ -138,13 +139,28 @@ export class NgrokHttpTunnel {
|
|
|
138
139
|
url(): string
|
|
139
140
|
/** The protocol of the endpoint that this tunnel backs. */
|
|
140
141
|
proto(): string
|
|
141
|
-
/**
|
|
142
|
+
/** Returns a tunnel's unique ID. */
|
|
142
143
|
id(): string
|
|
144
|
+
/**
|
|
145
|
+
* Returns a human-readable string presented in the ngrok dashboard
|
|
146
|
+
* and the Tunnels API. Use the [HttpTunnelBuilder::forwards_to],
|
|
147
|
+
* [TcpTunnelBuilder::forwards_to], etc. to set this value
|
|
148
|
+
* explicitly.
|
|
149
|
+
*/
|
|
150
|
+
forwardsTo(): string
|
|
151
|
+
/** Returns the arbitrary metadata string for this tunnel. */
|
|
152
|
+
metadata(): string
|
|
143
153
|
/** Forward incoming tunnel connections to the provided TCP address. */
|
|
144
154
|
forwardTcp(addr: string): Promise<void>
|
|
145
155
|
/** Forward incoming tunnel connections to the provided Unix socket path. */
|
|
146
156
|
forwardUnix(addr: string): Promise<void>
|
|
147
|
-
/**
|
|
157
|
+
/**
|
|
158
|
+
* Close the tunnel.
|
|
159
|
+
*
|
|
160
|
+
* This is an RPC call that must be `.await`ed.
|
|
161
|
+
* It is equivalent to calling `Session::close_tunnel` with this
|
|
162
|
+
* tunnel's ID.
|
|
163
|
+
*/
|
|
148
164
|
close(): Promise<void>
|
|
149
165
|
}
|
|
150
166
|
/**r" An ngrok tunnel backing a TCP endpoint. */
|
|
@@ -153,13 +169,28 @@ export class NgrokTcpTunnel {
|
|
|
153
169
|
url(): string
|
|
154
170
|
/** The protocol of the endpoint that this tunnel backs. */
|
|
155
171
|
proto(): string
|
|
156
|
-
/**
|
|
172
|
+
/** Returns a tunnel's unique ID. */
|
|
157
173
|
id(): string
|
|
174
|
+
/**
|
|
175
|
+
* Returns a human-readable string presented in the ngrok dashboard
|
|
176
|
+
* and the Tunnels API. Use the [HttpTunnelBuilder::forwards_to],
|
|
177
|
+
* [TcpTunnelBuilder::forwards_to], etc. to set this value
|
|
178
|
+
* explicitly.
|
|
179
|
+
*/
|
|
180
|
+
forwardsTo(): string
|
|
181
|
+
/** Returns the arbitrary metadata string for this tunnel. */
|
|
182
|
+
metadata(): string
|
|
158
183
|
/** Forward incoming tunnel connections to the provided TCP address. */
|
|
159
184
|
forwardTcp(addr: string): Promise<void>
|
|
160
185
|
/** Forward incoming tunnel connections to the provided Unix socket path. */
|
|
161
186
|
forwardUnix(addr: string): Promise<void>
|
|
162
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* Close the tunnel.
|
|
189
|
+
*
|
|
190
|
+
* This is an RPC call that must be `.await`ed.
|
|
191
|
+
* It is equivalent to calling `Session::close_tunnel` with this
|
|
192
|
+
* tunnel's ID.
|
|
193
|
+
*/
|
|
163
194
|
close(): Promise<void>
|
|
164
195
|
}
|
|
165
196
|
/**r" An ngrok tunnel bcking a TLS endpoint. */
|
|
@@ -168,26 +199,56 @@ export class NgrokTlsTunnel {
|
|
|
168
199
|
url(): string
|
|
169
200
|
/** The protocol of the endpoint that this tunnel backs. */
|
|
170
201
|
proto(): string
|
|
171
|
-
/**
|
|
202
|
+
/** Returns a tunnel's unique ID. */
|
|
172
203
|
id(): string
|
|
204
|
+
/**
|
|
205
|
+
* Returns a human-readable string presented in the ngrok dashboard
|
|
206
|
+
* and the Tunnels API. Use the [HttpTunnelBuilder::forwards_to],
|
|
207
|
+
* [TcpTunnelBuilder::forwards_to], etc. to set this value
|
|
208
|
+
* explicitly.
|
|
209
|
+
*/
|
|
210
|
+
forwardsTo(): string
|
|
211
|
+
/** Returns the arbitrary metadata string for this tunnel. */
|
|
212
|
+
metadata(): string
|
|
173
213
|
/** Forward incoming tunnel connections to the provided TCP address. */
|
|
174
214
|
forwardTcp(addr: string): Promise<void>
|
|
175
215
|
/** Forward incoming tunnel connections to the provided Unix socket path. */
|
|
176
216
|
forwardUnix(addr: string): Promise<void>
|
|
177
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Close the tunnel.
|
|
219
|
+
*
|
|
220
|
+
* This is an RPC call that must be `.await`ed.
|
|
221
|
+
* It is equivalent to calling `Session::close_tunnel` with this
|
|
222
|
+
* tunnel's ID.
|
|
223
|
+
*/
|
|
178
224
|
close(): Promise<void>
|
|
179
225
|
}
|
|
180
226
|
/**r" A labeled ngrok tunnel. */
|
|
181
227
|
export class NgrokLabeledTunnel {
|
|
182
228
|
/** The labels this tunnel was started with. */
|
|
183
229
|
labels(): Record<string, string>
|
|
184
|
-
/**
|
|
230
|
+
/** Returns a tunnel's unique ID. */
|
|
185
231
|
id(): string
|
|
232
|
+
/**
|
|
233
|
+
* Returns a human-readable string presented in the ngrok dashboard
|
|
234
|
+
* and the Tunnels API. Use the [HttpTunnelBuilder::forwards_to],
|
|
235
|
+
* [TcpTunnelBuilder::forwards_to], etc. to set this value
|
|
236
|
+
* explicitly.
|
|
237
|
+
*/
|
|
238
|
+
forwardsTo(): string
|
|
239
|
+
/** Returns the arbitrary metadata string for this tunnel. */
|
|
240
|
+
metadata(): string
|
|
186
241
|
/** Forward incoming tunnel connections to the provided TCP address. */
|
|
187
242
|
forwardTcp(addr: string): Promise<void>
|
|
188
243
|
/** Forward incoming tunnel connections to the provided Unix socket path. */
|
|
189
244
|
forwardUnix(addr: string): Promise<void>
|
|
190
|
-
/**
|
|
245
|
+
/**
|
|
246
|
+
* Close the tunnel.
|
|
247
|
+
*
|
|
248
|
+
* This is an RPC call that must be `.await`ed.
|
|
249
|
+
* It is equivalent to calling `Session::close_tunnel` with this
|
|
250
|
+
* tunnel's ID.
|
|
251
|
+
*/
|
|
191
252
|
close(): Promise<void>
|
|
192
253
|
}
|
|
193
254
|
/**r" An ngrok tunnel backing an HTTP endpoint. */
|
|
@@ -227,12 +288,12 @@ export class NgrokHttpTunnelBuilder {
|
|
|
227
288
|
* OAuth configuration.
|
|
228
289
|
* If not called, OAuth is disabled.
|
|
229
290
|
*/
|
|
230
|
-
oauth(provider: string, allowEmails
|
|
291
|
+
oauth(provider: string, allowEmails?: Array<string> | undefined | null, allowDomains?: Array<string> | undefined | null, scopes?: Array<string> | undefined | null): this
|
|
231
292
|
/**
|
|
232
293
|
* OIDC configuration.
|
|
233
294
|
* If not called, OIDC is disabled.
|
|
234
295
|
*/
|
|
235
|
-
oidc(issuerUrl: string, clientId: string, clientSecret: string, allowEmails
|
|
296
|
+
oidc(issuerUrl: string, clientId: string, clientSecret: string, allowEmails?: Array<string> | undefined | null, allowDomains?: Array<string> | undefined | null, scopes?: Array<string> | undefined | null): this
|
|
236
297
|
/**
|
|
237
298
|
* WebhookVerification configuration.
|
|
238
299
|
* If not called, WebhookVerification is disabled.
|
|
@@ -241,7 +302,7 @@ export class NgrokHttpTunnelBuilder {
|
|
|
241
302
|
/** Tunnel-specific opaque metadata. Viewable via the API. */
|
|
242
303
|
metadata(metadata: string): this
|
|
243
304
|
/** Begin listening for new connections on this tunnel. */
|
|
244
|
-
listen(): Promise<NgrokHttpTunnel>
|
|
305
|
+
listen(bind?: boolean | undefined | null): Promise<NgrokHttpTunnel>
|
|
245
306
|
/**
|
|
246
307
|
* Restriction placed on the origin of incoming connections to the edge to only allow these CIDR ranges.
|
|
247
308
|
* Call multiple times to add additional CIDR ranges.
|
|
@@ -252,7 +313,7 @@ export class NgrokHttpTunnelBuilder {
|
|
|
252
313
|
* Call multiple times to add additional CIDR ranges.
|
|
253
314
|
*/
|
|
254
315
|
denyCidr(cidr: string): this
|
|
255
|
-
/** The version of PROXY protocol to use with this tunnel,
|
|
316
|
+
/** The version of PROXY protocol to use with this tunnel "1", "2", or "" if not using. */
|
|
256
317
|
proxyProto(proxyProto: string): this
|
|
257
318
|
/**
|
|
258
319
|
* Tunnel backend metadata. Viewable via the dashboard and API, but has no
|
|
@@ -267,7 +328,7 @@ export class NgrokTcpTunnelBuilder {
|
|
|
267
328
|
/** Tunnel-specific opaque metadata. Viewable via the API. */
|
|
268
329
|
metadata(metadata: string): this
|
|
269
330
|
/** Begin listening for new connections on this tunnel. */
|
|
270
|
-
listen(): Promise<NgrokTcpTunnel>
|
|
331
|
+
listen(bind?: boolean | undefined | null): Promise<NgrokTcpTunnel>
|
|
271
332
|
/**
|
|
272
333
|
* Restriction placed on the origin of incoming connections to the edge to only allow these CIDR ranges.
|
|
273
334
|
* Call multiple times to add additional CIDR ranges.
|
|
@@ -278,7 +339,7 @@ export class NgrokTcpTunnelBuilder {
|
|
|
278
339
|
* Call multiple times to add additional CIDR ranges.
|
|
279
340
|
*/
|
|
280
341
|
denyCidr(cidr: string): this
|
|
281
|
-
/** The version of PROXY protocol to use with this tunnel,
|
|
342
|
+
/** The version of PROXY protocol to use with this tunnel "1", "2", or "" if not using. */
|
|
282
343
|
proxyProto(proxyProto: string): this
|
|
283
344
|
/**
|
|
284
345
|
* Tunnel backend metadata. Viewable via the dashboard and API, but has no
|
|
@@ -297,7 +358,7 @@ export class NgrokTlsTunnelBuilder {
|
|
|
297
358
|
/** Tunnel-specific opaque metadata. Viewable via the API. */
|
|
298
359
|
metadata(metadata: string): this
|
|
299
360
|
/** Begin listening for new connections on this tunnel. */
|
|
300
|
-
listen(): Promise<NgrokTlsTunnel>
|
|
361
|
+
listen(bind?: boolean | undefined | null): Promise<NgrokTlsTunnel>
|
|
301
362
|
/**
|
|
302
363
|
* Restriction placed on the origin of incoming connections to the edge to only allow these CIDR ranges.
|
|
303
364
|
* Call multiple times to add additional CIDR ranges.
|
|
@@ -308,7 +369,7 @@ export class NgrokTlsTunnelBuilder {
|
|
|
308
369
|
* Call multiple times to add additional CIDR ranges.
|
|
309
370
|
*/
|
|
310
371
|
denyCidr(cidr: string): this
|
|
311
|
-
/** The version of PROXY protocol to use with this tunnel,
|
|
372
|
+
/** The version of PROXY protocol to use with this tunnel "1", "2", or "" if not using. */
|
|
312
373
|
proxyProto(proxyProto: string): this
|
|
313
374
|
/**
|
|
314
375
|
* Tunnel backend metadata. Viewable via the dashboard and API, but has no
|
|
@@ -321,9 +382,16 @@ export class NgrokLabeledTunnelBuilder {
|
|
|
321
382
|
/** Tunnel-specific opaque metadata. Viewable via the API. */
|
|
322
383
|
metadata(metadata: string): this
|
|
323
384
|
/** Begin listening for new connections on this tunnel. */
|
|
324
|
-
listen(): Promise<NgrokLabeledTunnel>
|
|
385
|
+
listen(bind?: boolean | undefined | null): Promise<NgrokLabeledTunnel>
|
|
325
386
|
/** Add a label, value pair for this tunnel. */
|
|
326
387
|
label(label: string, value: string): this
|
|
327
388
|
}
|
|
328
|
-
|
|
329
|
-
export function
|
|
389
|
+
/** Generate, or convert a given tunnel, into one that can be passed into net.Server.listen(). */
|
|
390
|
+
export function listenable(tunnel?: (NgrokHttpTunnel|NgrokTcpTunnel|NgrokTlsTunnel|NgrokLabeledTunnel)): (NgrokHttpTunnel|NgrokTcpTunnel|NgrokTlsTunnel|NgrokLabeledTunnel)
|
|
391
|
+
/** Start the given net.Server listening to a generated, or passed in, tunnel. */
|
|
392
|
+
export function listen(server: import("net").Server, tunnel?: (NgrokHttpTunnel|NgrokTcpTunnel|NgrokTlsTunnel|NgrokLabeledTunnel)): (NgrokHttpTunnel|NgrokTcpTunnel|NgrokTlsTunnel|NgrokLabeledTunnel)
|
|
393
|
+
/**
|
|
394
|
+
* Register a console.log callback for ngrok INFO logging.
|
|
395
|
+
* Optionally set the logging level to one of ERROR, WARN, INFO, DEBUG, or TRACE.
|
|
396
|
+
*/
|
|
397
|
+
export function consoleLog(level?: String)
|