@ngrok/ngrok 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/Cargo.toml +2 -2
- package/RELEASE.md +1 -0
- 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 +7 -7
- package/docs/classes/NgrokSessionBuilder.html +15 -15
- 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 -1
- package/package.json +15 -15
- package/src/session.rs +3 -26
- package/src/tunnel.rs +1 -0
|
@@ -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/6152db9/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/6152db9/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/6152db9/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/6152db9/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,7 +20,7 @@
|
|
|
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><strong>Note: This is
|
|
23
|
+
<p><strong>Note: This is beta-quality software. Interfaces may change without warning.</strong></p>
|
|
24
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
|
|
25
25
|
service running inside a private network, such as on your local laptop. The ngrok agent is usually
|
|
26
26
|
deployed inside a private network and is used to communicate with the ngrok cloud service.</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrok/ngrok",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"napi": {
|
|
@@ -54,19 +54,19 @@
|
|
|
54
54
|
"description": "The ngrok agent in library form, suitable for integrating directly into your NodeJS application.",
|
|
55
55
|
"repository": "https://github.com/ngrok/ngrok-js",
|
|
56
56
|
"optionalDependencies": {
|
|
57
|
-
"@ngrok/ngrok-win32-x64-msvc": "0.1.
|
|
58
|
-
"@ngrok/ngrok-darwin-x64": "0.1.
|
|
59
|
-
"@ngrok/ngrok-linux-x64-gnu": "0.1.
|
|
60
|
-
"@ngrok/ngrok-darwin-arm64": "0.1.
|
|
61
|
-
"@ngrok/ngrok-android-arm64": "0.1.
|
|
62
|
-
"@ngrok/ngrok-linux-arm64-gnu": "0.1.
|
|
63
|
-
"@ngrok/ngrok-linux-arm64-musl": "0.1.
|
|
64
|
-
"@ngrok/ngrok-win32-arm64-msvc": "0.1.
|
|
65
|
-
"@ngrok/ngrok-linux-arm-gnueabihf": "0.1.
|
|
66
|
-
"@ngrok/ngrok-linux-x64-musl": "0.1.
|
|
67
|
-
"@ngrok/ngrok-freebsd-x64": "0.1.
|
|
68
|
-
"@ngrok/ngrok-win32-ia32-msvc": "0.1.
|
|
69
|
-
"@ngrok/ngrok-android-arm-eabi": "0.1.
|
|
70
|
-
"@ngrok/ngrok-darwin-universal": "0.1.
|
|
57
|
+
"@ngrok/ngrok-win32-x64-msvc": "0.1.1",
|
|
58
|
+
"@ngrok/ngrok-darwin-x64": "0.1.1",
|
|
59
|
+
"@ngrok/ngrok-linux-x64-gnu": "0.1.1",
|
|
60
|
+
"@ngrok/ngrok-darwin-arm64": "0.1.1",
|
|
61
|
+
"@ngrok/ngrok-android-arm64": "0.1.1",
|
|
62
|
+
"@ngrok/ngrok-linux-arm64-gnu": "0.1.1",
|
|
63
|
+
"@ngrok/ngrok-linux-arm64-musl": "0.1.1",
|
|
64
|
+
"@ngrok/ngrok-win32-arm64-msvc": "0.1.1",
|
|
65
|
+
"@ngrok/ngrok-linux-arm-gnueabihf": "0.1.1",
|
|
66
|
+
"@ngrok/ngrok-linux-x64-musl": "0.1.1",
|
|
67
|
+
"@ngrok/ngrok-freebsd-x64": "0.1.1",
|
|
68
|
+
"@ngrok/ngrok-win32-ia32-msvc": "0.1.1",
|
|
69
|
+
"@ngrok/ngrok-android-arm-eabi": "0.1.1",
|
|
70
|
+
"@ngrok/ngrok-darwin-universal": "0.1.1"
|
|
71
71
|
}
|
|
72
72
|
}
|
package/src/session.rs
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
use std::{
|
|
2
|
-
io,
|
|
3
2
|
sync::Arc,
|
|
4
3
|
time::Duration,
|
|
5
4
|
};
|
|
6
5
|
|
|
7
|
-
use async_rustls::rustls::
|
|
8
|
-
|
|
9
|
-
ClientConfig,
|
|
10
|
-
};
|
|
6
|
+
use async_rustls::rustls::ClientConfig;
|
|
7
|
+
use bytes::Bytes;
|
|
11
8
|
use napi::{
|
|
12
9
|
bindgen_prelude::*,
|
|
13
10
|
threadsafe_function::{
|
|
@@ -29,7 +26,6 @@ use ngrok::{
|
|
|
29
26
|
Session,
|
|
30
27
|
};
|
|
31
28
|
use parking_lot::Mutex as SyncMutex;
|
|
32
|
-
use rustls_pemfile::Item;
|
|
33
29
|
use tokio::sync::Mutex;
|
|
34
30
|
use tracing::{
|
|
35
31
|
debug,
|
|
@@ -173,27 +169,8 @@ impl NgrokSessionBuilder {
|
|
|
173
169
|
/// [root_cas parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#root_cas
|
|
174
170
|
#[napi]
|
|
175
171
|
pub fn ca_cert(&mut self, cert_bytes: Uint8Array) -> &Self {
|
|
176
|
-
let mut root_store = rustls::RootCertStore::empty();
|
|
177
|
-
let mut cert_pem = io::Cursor::new(cert_bytes);
|
|
178
|
-
root_store.add_parsable_certificates(
|
|
179
|
-
rustls_pemfile::read_all(&mut cert_pem)
|
|
180
|
-
.expect("a valid root certificate")
|
|
181
|
-
.into_iter()
|
|
182
|
-
.filter_map(|it| match it {
|
|
183
|
-
Item::X509Certificate(bs) => Some(bs),
|
|
184
|
-
_ => None,
|
|
185
|
-
})
|
|
186
|
-
.collect::<Vec<_>>()
|
|
187
|
-
.as_slice(),
|
|
188
|
-
);
|
|
189
|
-
|
|
190
|
-
let tls_config = rustls::ClientConfig::builder()
|
|
191
|
-
.with_safe_defaults()
|
|
192
|
-
.with_root_certificates(root_store)
|
|
193
|
-
.with_no_client_auth();
|
|
194
|
-
|
|
195
172
|
let mut builder = self.raw_builder.lock();
|
|
196
|
-
*builder = builder.clone().
|
|
173
|
+
*builder = builder.clone().ca_cert(Bytes::from(cert_bytes.to_vec()));
|
|
197
174
|
self
|
|
198
175
|
}
|
|
199
176
|
|
package/src/tunnel.rs
CHANGED
|
@@ -203,6 +203,7 @@ macro_rules! make_tunnel_type {
|
|
|
203
203
|
/// On Windows addr can be a named pipe, e.e. "\\.\pipe\an_ngrok_pipe"
|
|
204
204
|
#[napi]
|
|
205
205
|
pub async fn forward_pipe(&self, addr: String) -> Result<()> {
|
|
206
|
+
info!("Tunnel {:?} Pipe forwarding to {addr:?}", &self.id);
|
|
206
207
|
// we must clone the Arc before locking so we have a local reference
|
|
207
208
|
// to the mutex to unlock if this struct is dropped.
|
|
208
209
|
let arc = GLOBAL_TUNNELS.lock().await
|