From 39bee3667202a45072407f08a4b116db868f7c6d Mon Sep 17 00:00:00 2001 From: Benjamin Pollack Date: Wed, 12 Nov 2025 14:02:13 +0000 Subject: [PATCH 1/6] allow specifying endpoint bindings --- CHANGELOG.md | 4 ++++ index.d.ts | 24 ++++++++++++++++++++++++ src/config.rs | 4 ++++ src/connect.rs | 1 + src/listener_builder.rs | 9 +++++++++ 5 files changed, 42 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd4300a9..8ce628bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Unreleased + +- Support manually specifying bindings + ## 1.6.0 - Updated the internal ngrok SDK diff --git a/index.d.ts b/index.d.ts index 851ab97c..e8836dc7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -345,6 +345,12 @@ export interface Config { web_addr?: string /** Convert incoming websocket connections to TCP-like streams. */ websocket_tcp_converter?: boolean + /** + * Sets the ingress configuration for this endpoint. + * Valid values: "public", "internal", "kubernetes" + * If not specified, the ngrok service will use its default binding configuration. + */ + binding?: string } /** * Alias for {@link forward}. @@ -592,6 +598,12 @@ export declare class HttpListenerBuilder { forwardsTo(forwardsTo: string): this policy(policy: string): this trafficPolicy(trafficPolicy: string): this + /** + * Sets the ingress configuration for this endpoint. + * Valid values: "public", "internal", "kubernetes" + * If not specified, the ngrok service will use its default binding configuration. + */ + binding(binding: string): this } /** *r" An ngrok listener backing a TCP endpoint. @@ -644,6 +656,12 @@ export declare class TcpListenerBuilder { forwardsTo(forwardsTo: string): this policy(policy: string): this trafficPolicy(trafficPolicy: string): this + /** + * Sets the ingress configuration for this endpoint. + * Valid values: "public", "internal", "kubernetes" + * If not specified, the ngrok service will use its default binding configuration. + */ + binding(binding: string): this /** * The TCP address to request for this edge. * These addresses can be reserved in the [ngrok dashboard] to use across sessions. For example: remote_addr("2.tcp.ngrok.io:21746") @@ -705,6 +723,12 @@ export declare class TlsListenerBuilder { forwardsTo(forwardsTo: string): this policy(policy: string): this trafficPolicy(trafficPolicy: string): this + /** + * Sets the ingress configuration for this endpoint. + * Valid values: "public", "internal", "kubernetes" + * If not specified, the ngrok service will use its default binding configuration. + */ + binding(binding: string): this /** * The domain to request for this edge, any valid domain or hostname that you have * previously registered with ngrok. If using a custom domain, this requires diff --git a/src/config.rs b/src/config.rs index 2c2eab56..eed5454f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -325,4 +325,8 @@ pub struct Config { /// Convert incoming websocket connections to TCP-like streams. #[napi(js_name = "websocket_tcp_converter")] pub websocket_tcp_converter: Option, + /// Sets the ingress configuration for this endpoint. + /// Valid values: "public", "internal", "kubernetes" + /// If not specified, the ngrok service will use its default binding configuration. + pub binding: Option, } diff --git a/src/connect.rs b/src/connect.rs index 0aff068b..e395b463 100644 --- a/src/connect.rs +++ b/src/connect.rs @@ -105,6 +105,7 @@ macro_rules! config_common { plumb!($builder, $config, traffic_policy); // policy is in the process of being deprecated. for now, we just remap it to traffic_policy plumb!($builder, $config, traffic_policy, policy); + plumb!($builder, $config, binding); }; } diff --git a/src/listener_builder.rs b/src/listener_builder.rs index 641d2330..7e6c3ab8 100644 --- a/src/listener_builder.rs +++ b/src/listener_builder.rs @@ -176,6 +176,15 @@ macro_rules! make_listener_builder { builder.traffic_policy(traffic_policy); self } + /// Sets the ingress configuration for this endpoint. + /// Valid values: "public", "internal", "kubernetes" + /// If not specified, the ngrok service will use its default binding configuration. + #[napi] + pub fn binding(&mut self, binding: String) -> &Self { + let mut builder = self.listener_builder.lock(); + builder.binding(binding); + self + } } }; From 9965ee93c17e99f6d2d541f2e1463c6dcc6c41e7 Mon Sep 17 00:00:00 2001 From: kmvachhani Date: Tue, 18 Nov 2025 11:07:57 -0800 Subject: [PATCH 2/6] update aws-lc-sys to 0.29.0 --- Cargo.lock | 21 +++++++++++++++++---- Cargo.toml | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index af57640d..1fbc64c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,16 +67,29 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b756939cb2f8dc900aa6dcd505e6e2428e9cae7ff7b028c49e3946efa70878" dependencies = [ - "aws-lc-sys", + "aws-lc-sys 0.28.2", "untrusted 0.7.1", "zeroize", ] [[package]] name = "aws-lc-sys" -version = "0.28.0" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f7720b74ed28ca77f90769a71fd8c637a0137f6fae4ae947e1050229cff57f" +checksum = "bfa9b6986f250236c27e5a204062434a773a13243d2ffc2955f37bdba4c5c6a1" +dependencies = [ + "bindgen", + "cc", + "cmake", + "dunce", + "fs_extra", +] + +[[package]] +name = "aws-lc-sys" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61b1d86e7705efe1be1b569bab41d4fa1e14e220b60a160f78de2db687add079" dependencies = [ "bindgen", "cc", @@ -1129,7 +1142,7 @@ version = "1.6.0" dependencies = [ "async-trait", "aws-lc-rs", - "aws-lc-sys", + "aws-lc-sys 0.29.0", "bytes", "futures", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 02f519fc..fe52d39b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ tracing = "0.1.37" tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } url = "2.4.0" aws-lc-rs = "=1.13.0" -aws-lc-sys = "=0.28.0" +aws-lc-sys = "=0.29.0" [build-dependencies] napi-build = "2.0.1" From 17e85a5bbc08d6621ac1a07b99ced1a0ffc09b90 Mon Sep 17 00:00:00 2001 From: kmvachhani Date: Tue, 18 Nov 2025 15:24:37 -0800 Subject: [PATCH 3/6] use correct GCC cross-compilers --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 05808540..12af72bc 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ }, "scripts": { "artifacts": "napi artifacts", - "build": "napi build --platform --release --js gen.js --dts gen.d.ts --pipe 'node post-build.js trailer index'", + "build": "AWS_LC_SYS_CC_aarch64_unknown_linux_musl=aarch64-linux-musl-gcc AWS_LC_SYS_CXX_aarch64_unknown_linux_musl=aarch64-linux-musl-g++ napi build --platform --release --js gen.js --dts gen.d.ts --pipe 'node post-build.js trailer index'", "build:debug": "napi build --platform", "clean": "rm -rf node_modules/ target/", "docs": "mv trailer.d.ts trailer.d.hidden; mv examples .examples; npx typedoc index.d.ts --navigation.includeGroups; mv .examples examples; mv trailer.d.hidden trailer.d.ts", From 6124cf23ef04cecfb2481904b55ea2a872718110 Mon Sep 17 00:00:00 2001 From: kmvachhani Date: Tue, 18 Nov 2025 15:58:11 -0800 Subject: [PATCH 4/6] ignore aws-lc-sys dependency --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index fe52d39b..2934f934 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -36,4 +36,4 @@ napi-build = "2.0.1" lto = true [package.metadata.cargo-udeps.ignore] -normal = ["mio"] +normal = ["mio", "aws-lc-sys"] From 4348726f566a7cf7744a9957e580f274790aa08c Mon Sep 17 00:00:00 2001 From: kmvachhani Date: Tue, 18 Nov 2025 16:17:24 -0800 Subject: [PATCH 5/6] keep aws-lc-sys 0.28.0 --- Cargo.lock | 21 ++++----------------- Cargo.toml | 4 ++-- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1fbc64c0..af57640d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,29 +67,16 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b756939cb2f8dc900aa6dcd505e6e2428e9cae7ff7b028c49e3946efa70878" dependencies = [ - "aws-lc-sys 0.28.2", + "aws-lc-sys", "untrusted 0.7.1", "zeroize", ] [[package]] name = "aws-lc-sys" -version = "0.28.2" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa9b6986f250236c27e5a204062434a773a13243d2ffc2955f37bdba4c5c6a1" -dependencies = [ - "bindgen", - "cc", - "cmake", - "dunce", - "fs_extra", -] - -[[package]] -name = "aws-lc-sys" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b1d86e7705efe1be1b569bab41d4fa1e14e220b60a160f78de2db687add079" +checksum = "b9f7720b74ed28ca77f90769a71fd8c637a0137f6fae4ae947e1050229cff57f" dependencies = [ "bindgen", "cc", @@ -1142,7 +1129,7 @@ version = "1.6.0" dependencies = [ "async-trait", "aws-lc-rs", - "aws-lc-sys 0.29.0", + "aws-lc-sys", "bytes", "futures", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 2934f934..02f519fc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ tracing = "0.1.37" tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } url = "2.4.0" aws-lc-rs = "=1.13.0" -aws-lc-sys = "=0.29.0" +aws-lc-sys = "=0.28.0" [build-dependencies] napi-build = "2.0.1" @@ -36,4 +36,4 @@ napi-build = "2.0.1" lto = true [package.metadata.cargo-udeps.ignore] -normal = ["mio", "aws-lc-sys"] +normal = ["mio"] From 50d883a1083093cc738b1185e4a438fc5b8ef8e5 Mon Sep 17 00:00:00 2001 From: kmvachhani Date: Wed, 19 Nov 2025 09:39:41 -0800 Subject: [PATCH 6/6] update aws-lc-sys version --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index af57640d..bcfd9d3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -74,9 +74,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.28.0" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f7720b74ed28ca77f90769a71fd8c637a0137f6fae4ae947e1050229cff57f" +checksum = "bfa9b6986f250236c27e5a204062434a773a13243d2ffc2955f37bdba4c5c6a1" dependencies = [ "bindgen", "cc", diff --git a/Cargo.toml b/Cargo.toml index 02f519fc..b12f63d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ tracing = "0.1.37" tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } url = "2.4.0" aws-lc-rs = "=1.13.0" -aws-lc-sys = "=0.28.0" +aws-lc-sys = "=0.28.2" [build-dependencies] napi-build = "2.0.1"