@ngrok/ngrok 0.8.0 → 0.9.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 +12 -2
- package/CONTRIBUTING.md +4 -4
- package/README.md +179 -147
- package/index.d.ts +71 -16
- package/index.js +8 -6
- package/package.json +37 -16
- package/.envrc +0 -1
- package/.gitattributes +0 -3
- package/.prettierrc.json +0 -3
- package/.yarnrc.yml +0 -3
- package/Cargo.toml +0 -34
- package/RELEASE.md +0 -26
- package/build.rs +0 -5
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -85
- package/docs/assets/main.js +0 -58
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1367
- package/docs/classes/HttpListenerBuilder.html +0 -594
- package/docs/classes/LabeledListenerBuilder.html +0 -206
- package/docs/classes/Listener.html +0 -241
- package/docs/classes/Session.html +0 -207
- package/docs/classes/SessionBuilder.html +0 -465
- package/docs/classes/TcpListenerBuilder.html +0 -281
- package/docs/classes/TlsListenerBuilder.html +0 -322
- package/docs/classes/UpdateRequest.html +0 -131
- package/docs/functions/authtoken.html +0 -89
- package/docs/functions/connect.html +0 -89
- package/docs/functions/consoleLog.html +0 -90
- package/docs/functions/disconnect.html +0 -89
- package/docs/functions/getListener.html +0 -89
- package/docs/functions/getListenerByUrl.html +0 -89
- package/docs/functions/kill.html +0 -84
- package/docs/functions/listen.html +0 -92
- package/docs/functions/listenable.html +0 -85
- package/docs/functions/listeners.html +0 -84
- package/docs/functions/loggingCallback.html +0 -108
- package/docs/index.html +0 -292
- package/docs/interfaces/Config.html +0 -734
- package/docs/modules.html +0 -106
- package/examples/domain.crt +0 -18
- package/examples/domain.key +0 -27
- package/examples/express/ngrok-express-quickstart.js +0 -11
- package/examples/express/ngrok-express.js +0 -28
- package/examples/express/package.json +0 -7
- package/examples/fastify/ngrok-fastify.js +0 -26
- package/examples/fastify/package.json +0 -7
- package/examples/hapi/ngrok-hapi.js +0 -35
- package/examples/hapi/package.json +0 -7
- package/examples/koa/ngrok-koa.js +0 -12
- package/examples/koa/package.json +0 -7
- package/examples/nestjs/.eslintrc.js +0 -25
- package/examples/nestjs/.prettierrc +0 -4
- package/examples/nestjs/README.md +0 -73
- package/examples/nestjs/nest-cli.json +0 -8
- package/examples/nestjs/package.json +0 -70
- package/examples/nestjs/src/app.controller.spec.ts +0 -22
- package/examples/nestjs/src/app.controller.ts +0 -12
- package/examples/nestjs/src/app.module.ts +0 -10
- package/examples/nestjs/src/app.service.ts +0 -8
- package/examples/nestjs/src/main.ts +0 -17
- package/examples/nestjs/test/app.e2e-spec.ts +0 -24
- package/examples/nestjs/test/jest-e2e.json +0 -9
- package/examples/nestjs/tsconfig.build.json +0 -4
- package/examples/nestjs/tsconfig.json +0 -21
- package/examples/nextjs/README.md +0 -3
- package/examples/nextjs/next.config.js +0 -12
- package/examples/nextjs/ngrok.config.js +0 -23
- package/examples/nextjs/package.json +0 -6
- package/examples/nextjs/pages/index.js +0 -5
- package/examples/ngrok-connect-full.js +0 -67
- package/examples/ngrok-connect-minimal.js +0 -17
- package/examples/ngrok-http-full.js +0 -81
- package/examples/ngrok-http-minimum.js +0 -18
- package/examples/ngrok-labeled.js +0 -43
- package/examples/ngrok-listen.js +0 -11
- package/examples/ngrok-tcp.js +0 -37
- package/examples/ngrok-tls.js +0 -40
- package/examples/ngrok-typescript.ts +0 -69
- package/examples/ngrok-windows-pipe.js +0 -25
- package/examples/ngrok-winston.js +0 -24
- package/examples/package.json +0 -15
- package/examples/remix/.eslintrc.js +0 -4
- package/examples/remix/README.md +0 -53
- package/examples/remix/app/entry.client.tsx +0 -18
- package/examples/remix/app/entry.server.tsx +0 -101
- package/examples/remix/app/root.tsx +0 -20
- package/examples/remix/app/routes/_index.tsx +0 -30
- package/examples/remix/ngrok.config.js +0 -16
- package/examples/remix/package.json +0 -30
- package/examples/remix/public/favicon.ico +0 -0
- package/examples/remix/remix.config.js +0 -16
- package/examples/remix/remix.env.d.ts +0 -2
- package/examples/remix/tsconfig.json +0 -22
- package/examples/svelte/README.md +0 -38
- package/examples/svelte/jsconfig.json +0 -17
- package/examples/svelte/ngrok.config.cjs +0 -20
- package/examples/svelte/package.json +0 -22
- package/examples/svelte/src/app.d.ts +0 -12
- package/examples/svelte/src/app.html +0 -12
- package/examples/svelte/src/routes/+page.svelte +0 -2
- package/examples/svelte/static/favicon.png +0 -0
- package/examples/svelte/svelte.config.js +0 -14
- package/examples/svelte/vite.config.js +0 -6
- package/examples/vue/.vscode/extensions.json +0 -3
- package/examples/vue/README.md +0 -40
- package/examples/vue/env.d.ts +0 -1
- package/examples/vue/index.html +0 -13
- package/examples/vue/ngrok.config.ts +0 -18
- package/examples/vue/package.json +0 -25
- package/examples/vue/public/favicon.ico +0 -0
- package/examples/vue/src/App.vue +0 -47
- package/examples/vue/src/assets/base.css +0 -74
- package/examples/vue/src/assets/logo.svg +0 -1
- package/examples/vue/src/assets/main.css +0 -35
- package/examples/vue/src/components/HelloWorld.vue +0 -40
- package/examples/vue/src/components/TheWelcome.vue +0 -86
- package/examples/vue/src/components/WelcomeItem.vue +0 -86
- package/examples/vue/src/components/icons/IconCommunity.vue +0 -7
- package/examples/vue/src/components/icons/IconDocumentation.vue +0 -7
- package/examples/vue/src/components/icons/IconEcosystem.vue +0 -7
- package/examples/vue/src/components/icons/IconSupport.vue +0 -7
- package/examples/vue/src/components/icons/IconTooling.vue +0 -19
- package/examples/vue/src/main.ts +0 -6
- package/examples/vue/tsconfig.json +0 -16
- package/examples/vue/tsconfig.node.json +0 -8
- package/examples/vue/vite.config.ts +0 -15
- package/flake.lock +0 -82
- package/flake.nix +0 -111
- package/post-build.js +0 -45
- package/scripts/gc-node-drop.js +0 -49
- package/scripts/gc-rust-drop.js +0 -53
- package/src/config.rs +0 -285
- package/src/connect.rs +0 -340
- package/src/http.rs +0 -244
- package/src/lib.rs +0 -39
- package/src/listener.rs +0 -495
- package/src/listener_builder.rs +0 -204
- package/src/logging.rs +0 -140
- package/src/session.rs +0 -551
- package/src/tcp.rs +0 -18
- package/src/tls.rs +0 -44
- package/trailer.d.ts +0 -15
- package/trailer.js +0 -382
- package/tsconfig.json +0 -8
- package/typedoc.json +0 -3
package/scripts/gc-rust-drop.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// run with: node --trace-gc --expose-gc
|
|
2
|
-
if (typeof global.gc !== "function") {
|
|
3
|
-
console.log("must run with '--expose-gc'");
|
|
4
|
-
process.exit();
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const SegfaultHandler = require("../node_modules/segfault-handler");
|
|
8
|
-
SegfaultHandler.registerHandler("crash.log");
|
|
9
|
-
|
|
10
|
-
const http = require("http");
|
|
11
|
-
http
|
|
12
|
-
.createServer(function (req, res) {
|
|
13
|
-
res.writeHead(200);
|
|
14
|
-
res.write("Hello");
|
|
15
|
-
res.end();
|
|
16
|
-
})
|
|
17
|
-
.listen(8081);
|
|
18
|
-
|
|
19
|
-
var ngrok = require("..");
|
|
20
|
-
// turn on debug
|
|
21
|
-
ngrok.consoleLog();
|
|
22
|
-
|
|
23
|
-
new ngrok.SessionBuilder()
|
|
24
|
-
.authtokenFromEnv()
|
|
25
|
-
.connect()
|
|
26
|
-
.then((session) => {
|
|
27
|
-
session
|
|
28
|
-
.httpEndpoint()
|
|
29
|
-
.listen()
|
|
30
|
-
.then((listener) => {
|
|
31
|
-
listener.forward("localhost:8081").await;
|
|
32
|
-
const tun_id = listener.id();
|
|
33
|
-
console.log("listener: " + listener.url() + " id: " + tun_id);
|
|
34
|
-
console.log("\n\n=====> nulling listener");
|
|
35
|
-
listener = null; // nodejs can gc
|
|
36
|
-
|
|
37
|
-
setTimeout(function () {
|
|
38
|
-
console.log("\n\n=====> running gc");
|
|
39
|
-
global.gc();
|
|
40
|
-
}, 2000);
|
|
41
|
-
|
|
42
|
-
setTimeout(function () {
|
|
43
|
-
console.log("\n\n=====> closing listener");
|
|
44
|
-
session.closeListener(tun_id).await;
|
|
45
|
-
}, 4000);
|
|
46
|
-
|
|
47
|
-
setTimeout(function () {
|
|
48
|
-
console.log("\n\n=====> nulling session, running gc");
|
|
49
|
-
session = null;
|
|
50
|
-
global.gc();
|
|
51
|
-
}, 6000);
|
|
52
|
-
});
|
|
53
|
-
}).await;
|
package/src/config.rs
DELETED
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
use napi_derive::napi;
|
|
2
|
-
|
|
3
|
-
/// Configuration object to pass to ngrok.connect()
|
|
4
|
-
///
|
|
5
|
-
/// @group Functions
|
|
6
|
-
#[napi(object)]
|
|
7
|
-
#[derive(Default)]
|
|
8
|
-
pub struct Config {
|
|
9
|
-
/// Port, network address, or named pipe. Defaults to 80.
|
|
10
|
-
/// Examples: "80", "localhost:8080", "unix:/tmp/my.sock", "pipe://./my-pipe"
|
|
11
|
-
#[napi(ts_type = "number|string")]
|
|
12
|
-
pub addr: Option<String>,
|
|
13
|
-
// Synonym for basic_auth
|
|
14
|
-
#[napi(ts_type = "string|Array<string>")]
|
|
15
|
-
pub auth: Option<Vec<String>>,
|
|
16
|
-
/// Configures the session to authenticate with the provided authtoken. You
|
|
17
|
-
/// can [find your existing authtoken] or [create a new one] in the ngrok
|
|
18
|
-
/// dashboard.
|
|
19
|
-
///
|
|
20
|
-
/// See the [authtoken parameter in the ngrok docs] for additional details.
|
|
21
|
-
///
|
|
22
|
-
/// [find your existing authtoken]: https://dashboard.ngrok.com/get-started/your-authtoken
|
|
23
|
-
/// [create a new one]: https://dashboard.ngrok.com/tunnels/authtokens
|
|
24
|
-
/// [authtoken parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#authtoken
|
|
25
|
-
pub authtoken: Option<String>,
|
|
26
|
-
/// Shortcut for calling [SessionBuilder::authtoken] with the value of the
|
|
27
|
-
/// NGROK_AUTHTOKEN environment variable.
|
|
28
|
-
#[napi(js_name = "authtoken_from_env")]
|
|
29
|
-
pub authtoken_from_env: Option<bool>,
|
|
30
|
-
/// Credentials for basic authentication, with username and password colon separated.
|
|
31
|
-
#[napi(js_name = "basic_auth", ts_type = "string|Array<string>")]
|
|
32
|
-
pub basic_auth: Option<Vec<String>>,
|
|
33
|
-
/// Unused, will warn and be ignored
|
|
34
|
-
pub bin_path: Option<String>,
|
|
35
|
-
/// Reject requests when 5XX responses exceed this ratio.
|
|
36
|
-
/// Disabled when 0.
|
|
37
|
-
/// See [Circuit Breaker] in the ngrok docs for additional details.
|
|
38
|
-
///
|
|
39
|
-
/// [Circuit Breaker]: https://ngrok.com/docs/cloud-edge/modules/circuit-breaker/
|
|
40
|
-
#[napi(js_name = "circuit_breaker")]
|
|
41
|
-
pub circuit_breaker: Option<f64>,
|
|
42
|
-
/// Enable gzip compression for HTTP responses.
|
|
43
|
-
/// See [Compression] in the ngrok docs for additional details.
|
|
44
|
-
///
|
|
45
|
-
/// [Compression]: https://ngrok.com/docs/cloud-edge/modules/compression/
|
|
46
|
-
pub compression: Option<bool>,
|
|
47
|
-
/// Unused, will warn and be ignored
|
|
48
|
-
pub config_path: Option<String>,
|
|
49
|
-
/// The certificate to use for TLS termination at the ngrok edge in PEM format.
|
|
50
|
-
/// Only used if "proto" is "tls".
|
|
51
|
-
/// See [TLS Termination] in the ngrok docs for additional details.
|
|
52
|
-
///
|
|
53
|
-
/// [TLS Termination]: https://ngrok.com/docs/cloud-edge/modules/tls-termination/
|
|
54
|
-
pub crt: Option<String>,
|
|
55
|
-
/// The domain to request for this edge, any valid domain or hostname that you have
|
|
56
|
-
/// previously registered with ngrok. If using a custom domain, this requires
|
|
57
|
-
/// registering in the [ngrok dashboard] and setting a DNS CNAME value.
|
|
58
|
-
///
|
|
59
|
-
/// [ngrok dashboard]: https://dashboard.ngrok.com/cloud-edge/domains
|
|
60
|
-
pub domain: Option<String>,
|
|
61
|
-
/// Returns a human-readable string presented in the ngrok dashboard
|
|
62
|
-
/// and the API.
|
|
63
|
-
#[napi(js_name = "forwards_to")]
|
|
64
|
-
pub forwards_to: Option<String>,
|
|
65
|
-
/// Unused, will warn and be ignored
|
|
66
|
-
#[napi(js_name = "host_header")]
|
|
67
|
-
pub host_header: Option<String>,
|
|
68
|
-
/// The hostname for the listener to forward to.
|
|
69
|
-
/// Only used if addr is not defined.
|
|
70
|
-
pub host: Option<String>,
|
|
71
|
-
/// Synonym for domain
|
|
72
|
-
pub hostname: Option<String>,
|
|
73
|
-
/// Unused, will warn and be ignored
|
|
74
|
-
pub inspect: Option<String>,
|
|
75
|
-
/// Restriction placed on the origin of incoming connections to the edge to only allow these CIDR ranges.
|
|
76
|
-
#[napi(
|
|
77
|
-
js_name = "ip_restriction_allow_cidrs",
|
|
78
|
-
ts_type = "string|Array<string>"
|
|
79
|
-
)]
|
|
80
|
-
pub allow_cidr: Option<Vec<String>>,
|
|
81
|
-
/// Restriction placed on the origin of incoming connections to the edge to deny these CIDR ranges.
|
|
82
|
-
#[napi(
|
|
83
|
-
js_name = "ip_restriction_deny_cidrs",
|
|
84
|
-
ts_type = "string|Array<string>"
|
|
85
|
-
)]
|
|
86
|
-
pub deny_cidr: Option<Vec<String>>,
|
|
87
|
-
|
|
88
|
-
/// A set of regular expressions used to match User-Agents that will be allowed.
|
|
89
|
-
/// On request, the User Agent Filter module will check the incoming User-Agent header value
|
|
90
|
-
/// against the list of defined allow and deny regular expression rules.
|
|
91
|
-
/// See `User Agent Filter`_ in the ngrok docs for additional details.
|
|
92
|
-
///
|
|
93
|
-
/// .. _User Agent Filter: https://ngrok.com/docs/cloud-edge/modules/user-agent-filter/
|
|
94
|
-
#[napi(js_name = "allow_user_agent", ts_type = "string|Array<string>")]
|
|
95
|
-
pub allow_user_agent: Option<Vec<String>>,
|
|
96
|
-
/// A set of regular expressions used to match User-Agents that will be denied.
|
|
97
|
-
/// On request, the User Agent Filter module will check the incoming User-Agent header value
|
|
98
|
-
/// against the list of defined allow and deny regular expression rules.
|
|
99
|
-
/// See `User Agent Filter`_ in the ngrok docs for additional details.
|
|
100
|
-
///
|
|
101
|
-
/// .. _User Agent Filter: https://ngrok.com/docs/cloud-edge/modules/user-agent-filter/
|
|
102
|
-
#[napi(js_name = "deny_user_agent", ts_type = "string|Array<string>")]
|
|
103
|
-
pub deny_user_agent: Option<Vec<String>>,
|
|
104
|
-
|
|
105
|
-
/// The certificate to use for TLS termination at the ngrok edge in PEM format.
|
|
106
|
-
/// Only used if "proto" is "tls".
|
|
107
|
-
/// See [TLS Termination] in the ngrok docs for additional details.
|
|
108
|
-
///
|
|
109
|
-
/// [TLS Termination]: https://ngrok.com/docs/cloud-edge/modules/tls-termination/
|
|
110
|
-
pub key: Option<String>,
|
|
111
|
-
/// Add label, value pairs for this listener, colon separated.
|
|
112
|
-
#[napi(ts_type = "string|Array<string>")]
|
|
113
|
-
pub labels: Option<Vec<String>>,
|
|
114
|
-
/// Listener-specific opaque metadata. Viewable via the API.
|
|
115
|
-
pub metadata: Option<String>,
|
|
116
|
-
/// Certificates to use for client authentication at the ngrok edge.
|
|
117
|
-
/// Only used if "proto" is "tls" or "http".
|
|
118
|
-
/// See [Mutual TLS] in the ngrok docs for additional details.
|
|
119
|
-
///
|
|
120
|
-
/// [Mutual TLS]: https://ngrok.com/docs/cloud-edge/modules/mutual-tls/
|
|
121
|
-
#[napi(js_name = "mutual_tls_cas", ts_type = "string|Array<string>")]
|
|
122
|
-
pub mutual_tls_cas: Option<Vec<String>>,
|
|
123
|
-
/// Unused, will warn and be ignored
|
|
124
|
-
pub name: Option<String>,
|
|
125
|
-
|
|
126
|
-
/// OAuth configuration of domains to allow.
|
|
127
|
-
/// See [OAuth] in the ngrok docs for additional details.
|
|
128
|
-
///
|
|
129
|
-
/// [OAuth]: https://ngrok.com/docs/cloud-edge/modules/oauth/
|
|
130
|
-
#[napi(js_name = "oauth_allow_domains", ts_type = "string|Array<string>")]
|
|
131
|
-
pub oauth_allow_domains: Option<Vec<String>>,
|
|
132
|
-
/// OAuth configuration of email addresses to allow.
|
|
133
|
-
/// See [OAuth] in the ngrok docs for additional details.
|
|
134
|
-
///
|
|
135
|
-
/// [OAuth]: https://ngrok.com/docs/cloud-edge/modules/oauth/
|
|
136
|
-
#[napi(js_name = "oauth_allow_emails", ts_type = "string|Array<string>")]
|
|
137
|
-
pub oauth_allow_emails: Option<Vec<String>>,
|
|
138
|
-
/// OAuth configuration of scopes.
|
|
139
|
-
/// See [OAuth] in the ngrok docs for additional details.
|
|
140
|
-
///
|
|
141
|
-
/// [OAuth]: https://ngrok.com/docs/cloud-edge/modules/oauth/
|
|
142
|
-
#[napi(js_name = "oauth_scopes", ts_type = "string|Array<string>")]
|
|
143
|
-
pub oauth_scopes: Option<Vec<String>>,
|
|
144
|
-
/// OAuth configuration of the provider, e.g. "google".
|
|
145
|
-
/// See [OAuth] in the ngrok docs for additional details.
|
|
146
|
-
///
|
|
147
|
-
/// [OAuth]: https://ngrok.com/docs/cloud-edge/modules/oauth/
|
|
148
|
-
#[napi(js_name = "oauth_provider")]
|
|
149
|
-
pub oauth_provider: Option<String>,
|
|
150
|
-
/// OAuth configuration of client ID. Required for scopes.
|
|
151
|
-
/// See [OAuth] in the ngrok docs for additional details.
|
|
152
|
-
///
|
|
153
|
-
/// [OAuth]: https://ngrok.com/docs/cloud-edge/modules/oauth/
|
|
154
|
-
#[napi(js_name = "oauth_client_id")]
|
|
155
|
-
pub oauth_client_id: Option<String>,
|
|
156
|
-
/// OAuth configuration of client secret. Required for scopes.
|
|
157
|
-
/// See [OAuth] in the ngrok docs for additional details.
|
|
158
|
-
///
|
|
159
|
-
/// [OAuth]: https://ngrok.com/docs/cloud-edge/modules/oauth/
|
|
160
|
-
#[napi(js_name = "oauth_client_secret")]
|
|
161
|
-
pub oauth_client_secret: Option<String>,
|
|
162
|
-
|
|
163
|
-
/// OIDC configuration of client ID.
|
|
164
|
-
/// See [OpenID Connect] in the ngrok docs for additional details.
|
|
165
|
-
///
|
|
166
|
-
/// [OpenID Connect]: https://ngrok.com/docs/cloud-edge/modules/openid-connect/
|
|
167
|
-
#[napi(js_name = "oidc_client_id")]
|
|
168
|
-
pub oidc_client_id: Option<String>,
|
|
169
|
-
/// OIDC configuration of client secret.
|
|
170
|
-
/// See [OpenID Connect] in the ngrok docs for additional details.
|
|
171
|
-
///
|
|
172
|
-
/// [OpenID Connect]: https://ngrok.com/docs/cloud-edge/modules/openid-connect/
|
|
173
|
-
#[napi(js_name = "oidc_client_secret")]
|
|
174
|
-
pub oidc_client_secret: Option<String>,
|
|
175
|
-
/// OIDC configuration of scopes.
|
|
176
|
-
/// See [OpenID Connect] in the ngrok docs for additional details.
|
|
177
|
-
///
|
|
178
|
-
/// [OpenID Connect]: https://ngrok.com/docs/cloud-edge/modules/openid-connect/
|
|
179
|
-
#[napi(js_name = "oidc_scopes", ts_type = "string|Array<string>")]
|
|
180
|
-
pub oidc_scopes: Option<Vec<String>>,
|
|
181
|
-
/// OIDC configuration of the issuer URL.
|
|
182
|
-
/// See [OpenID Connect] in the ngrok docs for additional details.
|
|
183
|
-
///
|
|
184
|
-
/// [OpenID Connect]: https://ngrok.com/docs/cloud-edge/modules/openid-connect/
|
|
185
|
-
#[napi(js_name = "oidc_issuer_url")]
|
|
186
|
-
pub oidc_issuer_url: Option<String>,
|
|
187
|
-
/// OIDC configuration of domains to allow.
|
|
188
|
-
/// See [OpenID Connect] in the ngrok docs for additional details.
|
|
189
|
-
///
|
|
190
|
-
/// [OpenID Connect]: https://ngrok.com/docs/cloud-edge/modules/openid-connect/
|
|
191
|
-
#[napi(js_name = "oidc_allow_domains", ts_type = "string|Array<string>")]
|
|
192
|
-
pub oidc_allow_domains: Option<Vec<String>>,
|
|
193
|
-
/// OIDC configuration of email addresses to allow.
|
|
194
|
-
/// See [OpenID Connect] in the ngrok docs for additional details.
|
|
195
|
-
///
|
|
196
|
-
/// [OpenID Connect]: https://ngrok.com/docs/cloud-edge/modules/openid-connect/
|
|
197
|
-
#[napi(js_name = "oidc_allow_emails", ts_type = "string|Array<string>")]
|
|
198
|
-
pub oidc_allow_emails: Option<Vec<String>>,
|
|
199
|
-
|
|
200
|
-
/// Returns log messages from the ngrok library.
|
|
201
|
-
#[napi(ts_type = "(data: string) => void")]
|
|
202
|
-
pub on_log_event: Option<bool>,
|
|
203
|
-
/// 'closed' - connection is lost, 'connected' - reconnected
|
|
204
|
-
#[napi(ts_type = "(status: string) => void")]
|
|
205
|
-
pub on_status_change: Option<bool>,
|
|
206
|
-
/// The port for the listener to forward to.
|
|
207
|
-
/// Only used if addr is not defined.
|
|
208
|
-
pub port: Option<u32>,
|
|
209
|
-
/// The type of listener to use, one of http|tcp|tls|labeled, defaults to http.
|
|
210
|
-
pub proto: Option<String>,
|
|
211
|
-
/// The version of PROXY protocol to use with this listener "1", "2", or "" if not using.
|
|
212
|
-
#[napi(js_name = "proxy_proto")]
|
|
213
|
-
pub proxy_proto: Option<String>,
|
|
214
|
-
/// Adds a header to all requests to this edge.
|
|
215
|
-
/// See [Request Headers] in the ngrok docs for additional details.
|
|
216
|
-
///
|
|
217
|
-
/// [Request Headers]: https://ngrok.com/docs/cloud-edge/modules/request-headers/
|
|
218
|
-
#[napi(js_name = "request_header_add", ts_type = "string|Array<string>")]
|
|
219
|
-
pub request_header_add: Option<Vec<String>>,
|
|
220
|
-
/// Removes a header from requests to this edge.
|
|
221
|
-
/// See [Request Headers] in the ngrok docs for additional details.
|
|
222
|
-
///
|
|
223
|
-
/// [Request Headers]: https://ngrok.com/docs/cloud-edge/modules/request-headers/
|
|
224
|
-
#[napi(js_name = "request_header_remove", ts_type = "string|Array<string>")]
|
|
225
|
-
pub request_header_remove: Option<Vec<String>>,
|
|
226
|
-
/// Adds a header to all responses coming from this edge.
|
|
227
|
-
/// See [Response Headers] in the ngrok docs for additional details.
|
|
228
|
-
///
|
|
229
|
-
/// [Response Headers]: https://ngrok.com/docs/cloud-edge/modules/response-headers/
|
|
230
|
-
#[napi(js_name = "response_header_add", ts_type = "string|Array<string>")]
|
|
231
|
-
pub response_header_add: Option<Vec<String>>,
|
|
232
|
-
/// Removes a header from responses from this edge.
|
|
233
|
-
/// See [Response Headers] in the ngrok docs for additional details.
|
|
234
|
-
///
|
|
235
|
-
/// [Response Headers]: https://ngrok.com/docs/cloud-edge/modules/response-headers/
|
|
236
|
-
#[napi(js_name = "response_header_remove", ts_type = "string|Array<string>")]
|
|
237
|
-
pub response_header_remove: Option<Vec<String>>,
|
|
238
|
-
/// Unused, will warn and be ignored
|
|
239
|
-
pub region: Option<String>,
|
|
240
|
-
/// The TCP address to request for this edge.
|
|
241
|
-
/// These addresses can be reserved in the [ngrok dashboard] to use across sessions. For example: remote_addr("2.tcp.ngrok.io:21746")
|
|
242
|
-
/// Only used if proto is "tcp".
|
|
243
|
-
///
|
|
244
|
-
/// [ngrok dashboard]: https://dashboard.ngrok.com/cloud-edge/tcp-addresses
|
|
245
|
-
#[napi(js_name = "remote_addr")]
|
|
246
|
-
pub remote_addr: Option<String>,
|
|
247
|
-
/// The scheme that this edge should use.
|
|
248
|
-
/// "HTTPS" or "HTTP", defaults to "HTTPS".
|
|
249
|
-
/// If multiple are given only the last one is used.
|
|
250
|
-
#[napi(ts_type = "string|Array<string>")]
|
|
251
|
-
pub schemes: Option<Vec<String>>,
|
|
252
|
-
/// Configures the opaque, machine-readable metadata string for this session.
|
|
253
|
-
/// Metadata is made available to you in the ngrok dashboard and the Agents API
|
|
254
|
-
/// resource. It is a useful way to allow you to uniquely identify sessions. We
|
|
255
|
-
/// suggest encoding the value in a structured format like JSON.
|
|
256
|
-
///
|
|
257
|
-
/// See the [metdata parameter in the ngrok docs] for additional details.
|
|
258
|
-
///
|
|
259
|
-
/// [metdata parameter in the ngrok docs]: https://ngrok.com/docs/ngrok-agent/config#metadata
|
|
260
|
-
#[napi(js_name = "session_metadata")]
|
|
261
|
-
pub session_metadata: Option<String>,
|
|
262
|
-
/// Unused, use domain instead, will warn and be ignored
|
|
263
|
-
pub subdomain: Option<String>,
|
|
264
|
-
/// Unused, will warn and be ignored
|
|
265
|
-
#[napi(js_name = "terminate_at")]
|
|
266
|
-
pub terminate_at: Option<String>,
|
|
267
|
-
/// WebhookVerification configuration, the provider to use.
|
|
268
|
-
/// See [Webhook Verification] in the ngrok docs for additional details.
|
|
269
|
-
///
|
|
270
|
-
/// [Webhook Verification]: https://ngrok.com/docs/cloud-edge/modules/webhook-verification/
|
|
271
|
-
#[napi(js_name = "verify_webhook_provider")]
|
|
272
|
-
pub verify_webhook_provider: Option<String>,
|
|
273
|
-
/// WebhookVerification configuration, the secret to use.
|
|
274
|
-
/// See [Webhook Verification] in the ngrok docs for additional details.
|
|
275
|
-
///
|
|
276
|
-
/// [Webhook Verification]: https://ngrok.com/docs/cloud-edge/modules/webhook-verification/
|
|
277
|
-
#[napi(js_name = "verify_webhook_secret")]
|
|
278
|
-
pub verify_webhook_secret: Option<String>,
|
|
279
|
-
/// Unused, will warn and be ignored
|
|
280
|
-
#[napi(js_name = "web_addr")]
|
|
281
|
-
pub web_addr: Option<String>,
|
|
282
|
-
/// Convert incoming websocket connections to TCP-like streams.
|
|
283
|
-
#[napi(js_name = "websocket_tcp_converter")]
|
|
284
|
-
pub websocket_tcp_converter: Option<bool>,
|
|
285
|
-
}
|
package/src/connect.rs
DELETED
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
use lazy_static::lazy_static;
|
|
2
|
-
use napi::{
|
|
3
|
-
bindgen_prelude::*,
|
|
4
|
-
JsObject,
|
|
5
|
-
};
|
|
6
|
-
use napi_derive::napi;
|
|
7
|
-
use tokio::sync::Mutex;
|
|
8
|
-
use tracing::warn;
|
|
9
|
-
|
|
10
|
-
use crate::{
|
|
11
|
-
config::Config,
|
|
12
|
-
listener,
|
|
13
|
-
listener::TCP_PREFIX,
|
|
14
|
-
logging::logging_callback,
|
|
15
|
-
napi_err,
|
|
16
|
-
session::{
|
|
17
|
-
Session,
|
|
18
|
-
SessionBuilder,
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
lazy_static! {
|
|
23
|
-
// Save a user-facing NgrokSession to use for connect use cases
|
|
24
|
-
pub(crate) static ref SESSION: Mutex<Option<Session>> = Mutex::new(None);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/// Single string configuration
|
|
28
|
-
macro_rules! plumb {
|
|
29
|
-
($builder:tt, $config:tt, $name:tt) => {
|
|
30
|
-
plumb!($builder, $config, $name, $name)
|
|
31
|
-
};
|
|
32
|
-
($builder:tt, $config:tt, $name:tt, $config_name:tt) => {
|
|
33
|
-
if let Some(ref $name) = $config.$config_name {
|
|
34
|
-
$builder.$name($name.clone());
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/// Boolean configuration
|
|
40
|
-
macro_rules! plumb_bool {
|
|
41
|
-
($builder:tt, $config:tt, $name:tt) => {
|
|
42
|
-
plumb_bool!($builder, $config, $name, $name)
|
|
43
|
-
};
|
|
44
|
-
($builder:tt, $config:tt, $name:tt, $config_name:tt) => {
|
|
45
|
-
if let Some($name) = $config.$config_name {
|
|
46
|
-
if $name {
|
|
47
|
-
$builder.$name();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/// Vector configuration
|
|
54
|
-
macro_rules! plumb_vec {
|
|
55
|
-
($builder:tt, $config:tt, $name:tt) => {
|
|
56
|
-
plumb_vec!($builder, $config, $name, $name)
|
|
57
|
-
};
|
|
58
|
-
($builder:tt, $config:tt, $name:tt, $config_name:tt) => {
|
|
59
|
-
if let Some(ref $name) = $config.$config_name {
|
|
60
|
-
for val in $name {
|
|
61
|
-
$builder.$name(val.clone());
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
($builder:tt, $config:tt, $name:tt, $config_name:tt, vecu8) => {
|
|
66
|
-
if let Some(ref $name) = $config.$config_name {
|
|
67
|
-
for val in $name {
|
|
68
|
-
$builder.$name(Uint8Array::new(val.as_bytes().to_vec()));
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
($builder:tt, $config:tt, $name:tt, $config_name:tt, $split:tt) => {
|
|
73
|
-
if let Some(ref $name) = $config.$config_name {
|
|
74
|
-
for val in $name {
|
|
75
|
-
let (a, b) = val
|
|
76
|
-
.split_once($split)
|
|
77
|
-
.expect("split of value failed: ${val}");
|
|
78
|
-
$builder.$name(a.to_string(), b.to_string());
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/// All non-labeled listeners have these common configuration options
|
|
85
|
-
macro_rules! config_common {
|
|
86
|
-
($builder:tt, $config:tt) => {
|
|
87
|
-
plumb!($builder, $config, metadata);
|
|
88
|
-
plumb_vec!($builder, $config, allow_cidr);
|
|
89
|
-
plumb_vec!($builder, $config, deny_cidr);
|
|
90
|
-
plumb!($builder, $config, proxy_proto);
|
|
91
|
-
plumb!($builder, $config, forwards_to);
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/// Transform a json object configuration into a listener
|
|
96
|
-
#[napi(
|
|
97
|
-
ts_args_type = "config: Config|string|number",
|
|
98
|
-
ts_return_type = "Promise<string>"
|
|
99
|
-
)]
|
|
100
|
-
#[allow(dead_code)]
|
|
101
|
-
pub fn connect(
|
|
102
|
-
env: Env,
|
|
103
|
-
mut cfg: Config,
|
|
104
|
-
on_log_event: Option<JsFunction>,
|
|
105
|
-
on_connection: Option<JsFunction>,
|
|
106
|
-
on_disconnection: Option<JsFunction>,
|
|
107
|
-
) -> Result<JsObject> {
|
|
108
|
-
// do logging configuration before anything else
|
|
109
|
-
if on_log_event.is_some() {
|
|
110
|
-
logging_callback(env, on_log_event, None)?;
|
|
111
|
-
}
|
|
112
|
-
warn_unused(&cfg);
|
|
113
|
-
set_defaults(&mut cfg);
|
|
114
|
-
|
|
115
|
-
// session configuration
|
|
116
|
-
let mut s_builder = SessionBuilder::new();
|
|
117
|
-
plumb!(s_builder, cfg, authtoken);
|
|
118
|
-
plumb_bool!(s_builder, cfg, authtoken_from_env);
|
|
119
|
-
plumb!(s_builder, cfg, metadata, session_metadata);
|
|
120
|
-
if let Some(func) = on_connection {
|
|
121
|
-
s_builder.handle_connection(env, func);
|
|
122
|
-
}
|
|
123
|
-
if let Some(func) = on_disconnection {
|
|
124
|
-
s_builder.handle_disconnection(env, func);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// no longer need Env, hand off to async for listener creation, returning the promise to nodejs.
|
|
128
|
-
env.spawn_future(async_connect(s_builder, cfg))
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/// Connect the session, configure and start the listener
|
|
132
|
-
async fn async_connect(s_builder: SessionBuilder, config: Config) -> Result<String> {
|
|
133
|
-
// Using a singleton session for connect use cases
|
|
134
|
-
let mut opt = SESSION.lock().await;
|
|
135
|
-
if opt.is_none() {
|
|
136
|
-
opt.replace(s_builder.connect().await?);
|
|
137
|
-
}
|
|
138
|
-
let session = opt.as_ref().unwrap();
|
|
139
|
-
|
|
140
|
-
// listener configuration dispatch
|
|
141
|
-
let proto = config.proto.as_ref().unwrap();
|
|
142
|
-
let id = match proto.as_str() {
|
|
143
|
-
"http" => http_endpoint(session, &config).await?,
|
|
144
|
-
"tcp" => tcp_endpoint(session, &config).await?,
|
|
145
|
-
"tls" => tls_endpoint(session, &config).await?,
|
|
146
|
-
"labeled" => labeled_listener(session, &config).await?,
|
|
147
|
-
_ => return Err(napi_err(format!("unhandled protocol {proto}"))),
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
let url = listener::get_listener(id.clone())
|
|
151
|
-
.await
|
|
152
|
-
.and_then(|t| t.url())
|
|
153
|
-
.unwrap_or(id.clone());
|
|
154
|
-
|
|
155
|
-
// move forwarding to another task
|
|
156
|
-
if let Some(addr) = config.addr {
|
|
157
|
-
tokio::spawn(async move { listener::forward(&id, addr).await });
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
Ok(url)
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/// HTTP Listener configuration
|
|
164
|
-
async fn http_endpoint(session: &Session, cfg: &Config) -> Result<String> {
|
|
165
|
-
let mut bld = session.http_endpoint();
|
|
166
|
-
config_common!(bld, cfg);
|
|
167
|
-
plumb_vec!(bld, cfg, scheme, schemes);
|
|
168
|
-
plumb!(bld, cfg, domain, hostname); // synonym for domain
|
|
169
|
-
plumb!(bld, cfg, domain);
|
|
170
|
-
plumb_vec!(bld, cfg, mutual_tlsca, mutual_tls_cas, vecu8);
|
|
171
|
-
plumb_bool!(bld, cfg, compression);
|
|
172
|
-
plumb_bool!(bld, cfg, websocket_tcp_conversion, websocket_tcp_converter);
|
|
173
|
-
plumb_vec!(bld, cfg, request_header, request_header_add, ":");
|
|
174
|
-
plumb_vec!(bld, cfg, response_header, response_header_add, ":");
|
|
175
|
-
plumb_vec!(bld, cfg, remove_request_header, request_header_remove);
|
|
176
|
-
plumb_vec!(bld, cfg, remove_response_header, response_header_remove);
|
|
177
|
-
plumb_vec!(bld, cfg, basic_auth, basic_auth, ":");
|
|
178
|
-
plumb_vec!(bld, cfg, allow_user_agent, allow_user_agent);
|
|
179
|
-
plumb_vec!(bld, cfg, deny_user_agent, deny_user_agent);
|
|
180
|
-
// circuit breaker
|
|
181
|
-
if let Some(circuit_breaker) = cfg.circuit_breaker {
|
|
182
|
-
bld.circuit_breaker(circuit_breaker);
|
|
183
|
-
}
|
|
184
|
-
// oauth
|
|
185
|
-
if let Some(ref provider) = cfg.oauth_provider {
|
|
186
|
-
bld.oauth(
|
|
187
|
-
provider.clone(),
|
|
188
|
-
cfg.oauth_allow_emails.clone(),
|
|
189
|
-
cfg.oauth_allow_domains.clone(),
|
|
190
|
-
cfg.oauth_scopes.clone(),
|
|
191
|
-
cfg.oauth_client_id.clone(),
|
|
192
|
-
cfg.oauth_client_secret.clone(),
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
// oidc
|
|
196
|
-
if let Some(ref issuer_url) = cfg.oidc_issuer_url {
|
|
197
|
-
if cfg.oidc_client_id.is_none() {
|
|
198
|
-
return Err(napi_err("Missing client id for oidc"));
|
|
199
|
-
}
|
|
200
|
-
if cfg.oidc_client_secret.is_none() {
|
|
201
|
-
return Err(napi_err("Missing client secret for oidc"));
|
|
202
|
-
}
|
|
203
|
-
bld.oidc(
|
|
204
|
-
issuer_url.clone(),
|
|
205
|
-
cfg.oidc_client_id.clone().unwrap(),
|
|
206
|
-
cfg.oidc_client_secret.clone().unwrap(),
|
|
207
|
-
cfg.oidc_allow_emails.clone(),
|
|
208
|
-
cfg.oidc_allow_domains.clone(),
|
|
209
|
-
cfg.oidc_scopes.clone(),
|
|
210
|
-
);
|
|
211
|
-
}
|
|
212
|
-
// webhook verification
|
|
213
|
-
if let Some(ref provider) = cfg.verify_webhook_provider {
|
|
214
|
-
if let Some(ref secret) = cfg.verify_webhook_secret {
|
|
215
|
-
bld.webhook_verification(provider.clone(), secret.clone());
|
|
216
|
-
} else {
|
|
217
|
-
return Err(napi_err("Missing secret for webhook verification"));
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
Ok(bld.listen(None).await?.id())
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
/// TCP Listener configuration
|
|
224
|
-
async fn tcp_endpoint(session: &Session, cfg: &Config) -> Result<String> {
|
|
225
|
-
let mut bld = session.tcp_endpoint();
|
|
226
|
-
config_common!(bld, cfg);
|
|
227
|
-
plumb!(bld, cfg, remote_addr);
|
|
228
|
-
Ok(bld.listen(None).await?.id())
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/// TLS Listener configuration
|
|
232
|
-
async fn tls_endpoint(session: &Session, cfg: &Config) -> Result<String> {
|
|
233
|
-
let mut bld = session.tls_endpoint();
|
|
234
|
-
config_common!(bld, cfg);
|
|
235
|
-
plumb!(bld, cfg, domain, hostname); // synonym for domain
|
|
236
|
-
plumb!(bld, cfg, domain);
|
|
237
|
-
plumb_vec!(bld, cfg, mutual_tlsca, mutual_tls_cas, vecu8);
|
|
238
|
-
if let Some(ref crt) = cfg.crt {
|
|
239
|
-
if let Some(ref key) = cfg.key {
|
|
240
|
-
bld.termination(
|
|
241
|
-
Uint8Array::new(crt.as_bytes().to_vec()),
|
|
242
|
-
Uint8Array::new(key.as_bytes().to_vec()),
|
|
243
|
-
);
|
|
244
|
-
} else {
|
|
245
|
-
return Err(napi_err("Missing key for tls termination"));
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
Ok(bld.listen(None).await?.id())
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/// Labeled Listener configuration
|
|
252
|
-
async fn labeled_listener(session: &Session, cfg: &Config) -> Result<String> {
|
|
253
|
-
let mut bld = session.labeled_listener();
|
|
254
|
-
plumb!(bld, cfg, metadata);
|
|
255
|
-
plumb_vec!(bld, cfg, label, labels, ":");
|
|
256
|
-
Ok(bld.listen(None).await?.id())
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
/// Set the expected defaults for configuration values
|
|
260
|
-
fn set_defaults(config: &mut Config) {
|
|
261
|
-
if config.proto.is_none() {
|
|
262
|
-
config.proto.replace("http".to_string());
|
|
263
|
-
}
|
|
264
|
-
if config.addr.is_none() {
|
|
265
|
-
if let Some(port) = &config.port {
|
|
266
|
-
if let Some(host) = &config.host {
|
|
267
|
-
config.addr.replace(format!("{TCP_PREFIX}{host}:{port}"));
|
|
268
|
-
} else {
|
|
269
|
-
config.addr.replace(format!("{TCP_PREFIX}localhost:{port}"));
|
|
270
|
-
}
|
|
271
|
-
} else if let Some(host) = &config.host {
|
|
272
|
-
config.addr.replace(host.clone());
|
|
273
|
-
} else {
|
|
274
|
-
config.addr.replace("80".to_string());
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
if let Some(addr) = &config.addr {
|
|
278
|
-
if addr.parse::<i32>().is_ok() {
|
|
279
|
-
// the string is a number, interpret it as a port
|
|
280
|
-
config.addr.replace(format!("{TCP_PREFIX}localhost:{addr}"));
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
/// Warn about unused configuration values
|
|
286
|
-
fn warn_unused(config: &Config) {
|
|
287
|
-
if config.bin_path.is_some() {
|
|
288
|
-
warn!("bin_path is unused");
|
|
289
|
-
}
|
|
290
|
-
if config.config_path.is_some() {
|
|
291
|
-
warn!("config_path is unused");
|
|
292
|
-
}
|
|
293
|
-
if config.host_header.is_some() {
|
|
294
|
-
warn!("host_header is unused");
|
|
295
|
-
}
|
|
296
|
-
if config.inspect.is_some() {
|
|
297
|
-
warn!("inspect is unused");
|
|
298
|
-
}
|
|
299
|
-
if config.name.is_some() {
|
|
300
|
-
warn!("name is unused");
|
|
301
|
-
}
|
|
302
|
-
if config.region.is_some() {
|
|
303
|
-
warn!("region is unused");
|
|
304
|
-
}
|
|
305
|
-
if let Some(ref schemes) = config.schemes {
|
|
306
|
-
if schemes.len() > 1 {
|
|
307
|
-
warn!("Multiple schemes set, only last one will be used");
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
if config.subdomain.is_some() {
|
|
311
|
-
warn!("subdomain is unused");
|
|
312
|
-
}
|
|
313
|
-
if config.terminate_at.is_some() {
|
|
314
|
-
warn!("terminate_at is unused");
|
|
315
|
-
}
|
|
316
|
-
if config.web_addr.is_some() {
|
|
317
|
-
warn!("web_addr is unused");
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/// Close a listener with the given url, or all listeners if no url is defined.
|
|
322
|
-
#[napi]
|
|
323
|
-
#[allow(dead_code)]
|
|
324
|
-
pub async fn disconnect(url: Option<String>) -> Result<()> {
|
|
325
|
-
listener::close_url(url.clone()).await?;
|
|
326
|
-
|
|
327
|
-
// if closing every listener, remove any stored session
|
|
328
|
-
if url.as_ref().is_none() {
|
|
329
|
-
SESSION.lock().await.take();
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
Ok(())
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
/// Close all listeners.
|
|
336
|
-
#[napi]
|
|
337
|
-
#[allow(dead_code)]
|
|
338
|
-
pub async fn kill() -> Result<()> {
|
|
339
|
-
disconnect(None).await
|
|
340
|
-
}
|