mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
Add unstable checks for unix transport (#5818)
Also remove the unix example from the stable documentation to stay in line with the `Deno.listen` one
This commit is contained in:
parent
f6e3160356
commit
b7f0b073bb
3 changed files with 6 additions and 3 deletions
3
cli/js/lib.deno.ns.d.ts
vendored
3
cli/js/lib.deno.ns.d.ts
vendored
|
@ -1612,10 +1612,9 @@ declare namespace Deno {
|
||||||
* const conn2 = await Deno.connect({ hostname: "192.0.2.1", 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 conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 });
|
||||||
* const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" });
|
* 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. */
|
* Requires `allow-net` permission for "tcp". */
|
||||||
export function connect(options: ConnectOptions): Promise<Conn>;
|
export function connect(options: ConnectOptions): Promise<Conn>;
|
||||||
|
|
||||||
export interface ConnectTlsOptions {
|
export interface ConnectTlsOptions {
|
||||||
|
|
2
cli/js/lib.deno.unstable.d.ts
vendored
2
cli/js/lib.deno.unstable.d.ts
vendored
|
@ -1067,7 +1067,7 @@ declare namespace Deno {
|
||||||
* const conn5 = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" });
|
* const conn5 = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" });
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* Requires `allow-net` permission for "tcp" and `allow-read` for unix. */
|
* Requires `allow-net` permission for "tcp" and `allow-read` for "unix". */
|
||||||
export function connect(
|
export function connect(
|
||||||
options: ConnectOptions | UnixConnectOptions
|
options: ConnectOptions | UnixConnectOptions
|
||||||
): Promise<Conn>;
|
): Promise<Conn>;
|
||||||
|
|
|
@ -302,6 +302,7 @@ fn op_connect(
|
||||||
transport_args: ArgsEnum::Unix(args),
|
transport_args: ArgsEnum::Unix(args),
|
||||||
} if transport == "unix" => {
|
} if transport == "unix" => {
|
||||||
let address_path = net_unix::Path::new(&args.path);
|
let address_path = net_unix::Path::new(&args.path);
|
||||||
|
state.check_unstable("Deno.connect");
|
||||||
state.check_read(&address_path)?;
|
state.check_read(&address_path)?;
|
||||||
let op = async move {
|
let op = async move {
|
||||||
let path = args.path;
|
let path = args.path;
|
||||||
|
@ -524,6 +525,9 @@ fn op_listen(
|
||||||
transport,
|
transport,
|
||||||
transport_args: ArgsEnum::Unix(args),
|
transport_args: ArgsEnum::Unix(args),
|
||||||
} if transport == "unix" || transport == "unixpacket" => {
|
} if transport == "unix" || transport == "unixpacket" => {
|
||||||
|
if transport == "unix" {
|
||||||
|
state.check_unstable("Deno.listen");
|
||||||
|
}
|
||||||
if transport == "unixpacket" {
|
if transport == "unixpacket" {
|
||||||
state.check_unstable("Deno.listenDatagram");
|
state.check_unstable("Deno.listenDatagram");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue