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/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" 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/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", 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 + } } };