diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-01-14 22:50:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-14 21:50:58 +0000 |
commit | fc17ddbcc43708b6265758bc3e034ab0b5fcb8c3 (patch) | |
tree | ceced940a82061b7d4644d09e8242a3a3cdaea41 | |
parent | 658b5596577a9349e1c8e66885491c9c36a6bc73 (diff) |
feat: Stabilize Deno.connect for 'unix' transport (#21937)
-rw-r--r-- | cli/tsc/dts/lib.deno.unstable.d.ts | 48 | ||||
-rw-r--r-- | ext/net/lib.deno_net.d.ts | 25 | ||||
-rw-r--r-- | ext/net/ops_unix.rs | 1 |
3 files changed, 25 insertions, 49 deletions
diff --git a/cli/tsc/dts/lib.deno.unstable.d.ts b/cli/tsc/dts/lib.deno.unstable.d.ts index dd86d709a..555a6d5d8 100644 --- a/cli/tsc/dts/lib.deno.unstable.d.ts +++ b/cli/tsc/dts/lib.deno.unstable.d.ts @@ -1127,54 +1127,6 @@ declare namespace Deno { /** **UNSTABLE**: New API, yet to be vetted. * - * @category Network - */ - export interface UnixConnectOptions { - transport: "unix"; - path: string; - } - - /** **UNSTABLE**: New API, yet to be vetted. - * - * Connects to the hostname (default is "127.0.0.1") and port on the named - * transport (default is "tcp"), and resolves to the connection (`Conn`). - * - * ```ts - * const conn1 = await Deno.connect({ port: 80 }); - * const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 }); - * const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 }); - * const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" }); - * const conn5 = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" }); - * ``` - * - * Requires `allow-net` permission for "tcp" and `allow-read` for "unix". - * - * @tags allow-net, allow-read - * @category Network - */ - export function connect(options: ConnectOptions): Promise<TcpConn>; - /** **UNSTABLE**: New API, yet to be vetted. - * - * Connects to the hostname (default is "127.0.0.1") and port on the named - * transport (default is "tcp"), and resolves to the connection (`Conn`). - * - * ```ts - * const conn1 = await Deno.connect({ port: 80 }); - * const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 }); - * const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 }); - * const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" }); - * const conn5 = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" }); - * ``` - * - * Requires `allow-net` permission for "tcp" and `allow-read` for "unix". - * - * @tags allow-net, allow-read - * @category Network - */ - export function connect(options: UnixConnectOptions): Promise<UnixConn>; - - /** **UNSTABLE**: New API, yet to be vetted. - * * Acquire an advisory file-system lock for the provided file. * * @param [exclusive=false] diff --git a/ext/net/lib.deno_net.d.ts b/ext/net/lib.deno_net.d.ts index 64744b19e..e77b1bc6f 100644 --- a/ext/net/lib.deno_net.d.ts +++ b/ext/net/lib.deno_net.d.ts @@ -224,9 +224,34 @@ declare namespace Deno { } /** @category Network */ + export interface UnixConnectOptions { + transport: "unix"; + path: string; + } + + /** @category Network */ // deno-lint-ignore no-empty-interface export interface UnixConn extends Conn {} + /** Connects to the hostname (default is "127.0.0.1") and port on the named + * transport (default is "tcp"), and resolves to the connection (`Conn`). + * + * ```ts + * const conn1 = await Deno.connect({ port: 80 }); + * const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 }); + * const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 }); + * const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" }); + * const conn5 = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" }); + * ``` + * + * Requires `allow-net` permission for "tcp" and `allow-read` for "unix". + * + * @tags allow-net, allow-read + * @category Network + */ + // deno-lint-ignore adjacent-overload-signatures + export function connect(options: UnixConnectOptions): Promise<UnixConn>; + /** @category Network */ export interface ConnectTlsOptions { /** The port to connect to. */ diff --git a/ext/net/ops_unix.rs b/ext/net/ops_unix.rs index 5a9ad7be9..be3e9d153 100644 --- a/ext/net/ops_unix.rs +++ b/ext/net/ops_unix.rs @@ -114,7 +114,6 @@ where NP: NetPermissions + 'static, { let address_path = Path::new(&path); - super::check_unstable(&state.borrow(), "Deno.connect"); { let mut state_ = state.borrow_mut(); state_ |