diff options
Diffstat (limited to 'cli/js')
-rw-r--r-- | cli/js/lib.deno.ns.d.ts | 12 | ||||
-rw-r--r-- | cli/js/net.ts | 4 | ||||
-rw-r--r-- | cli/js/ops/net.ts | 2 | ||||
-rw-r--r-- | cli/js/tests/net_test.ts | 34 |
4 files changed, 26 insertions, 26 deletions
diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index 0c6f8ab18..4626f6214 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -1829,7 +1829,7 @@ declare namespace Deno { export interface UnixAddr { transport: "unix" | "unixpacket"; - address: string; + path: string; } export type Addr = NetAddr | UnixAddr; @@ -1917,7 +1917,7 @@ declare namespace Deno { export interface UnixListenOptions { /** A Path to the Unix Socket. */ - address: string; + path: string; } /** **UNSTABLE**: new API, yet to be vetted. * @@ -1936,7 +1936,7 @@ declare namespace Deno { * * Listen announces on the local transport address. * - * const listener = Deno.listen({ address: "/foo/bar.sock", transport: "unix" }) + * const listener = Deno.listen({ path: "/foo/bar.sock", transport: "unix" }) * * Requires `allow-read` and `allow-write` permission. */ export function listen( @@ -1957,7 +1957,7 @@ declare namespace Deno { * * Listen announces on the local transport address. * - * const listener = Deno.listen({ address: "/foo/bar.sock", transport: "unixpacket" }) + * const listener = Deno.listen({ path: "/foo/bar.sock", transport: "unixpacket" }) * * Requires `allow-read` and `allow-write` permission. */ export function listen( @@ -1992,7 +1992,7 @@ declare namespace Deno { export interface UnixConnectOptions { transport: "unix"; - address: string; + path: string; } /** @@ -2003,7 +2003,7 @@ declare namespace Deno { * 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({ address: "/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. */ export function connect( diff --git a/cli/js/net.ts b/cli/js/net.ts index 92fdfe3ac..6f6736ee2 100644 --- a/cli/js/net.ts +++ b/cli/js/net.ts @@ -142,7 +142,7 @@ export interface ListenOptions { export interface UnixListenOptions { transport: "unix" | "unixpacket"; - address: string; + path: string; } export function listen( @@ -190,7 +190,7 @@ export interface ConnectOptions { } export interface UnixConnectOptions { transport: "unix"; - address: string; + path: string; } export async function connect(options: UnixConnectOptions): Promise<Conn>; export async function connect(options: ConnectOptions): Promise<Conn>; diff --git a/cli/js/ops/net.ts b/cli/js/ops/net.ts index d04c7ba8f..f2d272fe9 100644 --- a/cli/js/ops/net.ts +++ b/cli/js/ops/net.ts @@ -9,7 +9,7 @@ export interface NetAddr { export interface UnixAddr { transport: "unix" | "unixpacket"; - address: string; + path: string; } export type Addr = NetAddr | UnixAddr; diff --git a/cli/js/tests/net_test.ts b/cli/js/tests/net_test.ts index c8c9a893a..8840730a8 100644 --- a/cli/js/tests/net_test.ts +++ b/cli/js/tests/net_test.ts @@ -38,11 +38,11 @@ unitTest( function netUnixListenClose(): void { const filePath = Deno.makeTempFileSync(); const socket = Deno.listen({ - address: filePath, + path: filePath, transport: "unix", }); assert(socket.addr.transport === "unix"); - assertEquals(socket.addr.address, filePath); + assertEquals(socket.addr.path, filePath); socket.close(); } ); @@ -52,11 +52,11 @@ unitTest( function netUnixPacketListenClose(): void { const filePath = Deno.makeTempFileSync(); const socket = Deno.listen({ - address: filePath, + path: filePath, transport: "unixpacket", }); assert(socket.addr.transport === "unixpacket"); - assertEquals(socket.addr.address, filePath); + assertEquals(socket.addr.path, filePath); socket.close(); } ); @@ -86,7 +86,7 @@ unitTest( async function netUnixCloseWhileAccept(): Promise<void> { const filePath = await Deno.makeTempFile(); const listener = Deno.listen({ - address: filePath, + path: filePath, transport: "unix", }); const p = listener.accept(); @@ -131,7 +131,7 @@ unitTest( { ignore: true, perms: { read: true, write: true } }, async function netUnixConcurrentAccept(): Promise<void> { const filePath = await Deno.makeTempFile(); - const listener = Deno.listen({ transport: "unix", address: filePath }); + const listener = Deno.listen({ transport: "unix", path: filePath }); let acceptErrCount = 0; const checkErr = (e: Error): void => { if (e.message === "Listener has been closed") { @@ -192,19 +192,19 @@ unitTest( { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, async function netUnixDialListen(): Promise<void> { const filePath = await Deno.makeTempFile(); - const listener = Deno.listen({ address: filePath, transport: "unix" }); + const listener = Deno.listen({ path: filePath, transport: "unix" }); listener.accept().then( async (conn): Promise<void> => { assert(conn.remoteAddr != null); assert(conn.localAddr.transport === "unix"); - assertEquals(conn.localAddr.address, filePath); + assertEquals(conn.localAddr.path, filePath); await conn.write(new Uint8Array([1, 2, 3])); conn.close(); } ); - const conn = await Deno.connect({ address: filePath, transport: "unix" }); + const conn = await Deno.connect({ path: filePath, transport: "unix" }); assert(conn.remoteAddr.transport === "unix"); - assertEquals(conn.remoteAddr.address, filePath); + assertEquals(conn.remoteAddr.path, filePath); assert(conn.remoteAddr != null); const buf = new Uint8Array(1024); const readResult = await conn.read(buf); @@ -256,20 +256,20 @@ unitTest( { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, async function netUnixPacketSendReceive(): Promise<void> { const filePath = await Deno.makeTempFile(); - const alice = Deno.listen({ address: filePath, transport: "unixpacket" }); + const alice = Deno.listen({ path: filePath, transport: "unixpacket" }); assert(alice.addr.transport === "unixpacket"); - assertEquals(alice.addr.address, filePath); + assertEquals(alice.addr.path, filePath); - const bob = Deno.listen({ address: filePath, transport: "unixpacket" }); + const bob = Deno.listen({ path: filePath, transport: "unixpacket" }); assert(bob.addr.transport === "unixpacket"); - assertEquals(bob.addr.address, filePath); + assertEquals(bob.addr.path, filePath); const sent = new Uint8Array([1, 2, 3]); await alice.send(sent, bob.addr); const [recvd, remote] = await bob.receive(); assert(remote.transport === "unixpacket"); - assertEquals(remote.address, filePath); + assertEquals(remote.path, filePath); assertEquals(recvd.length, 3); assertEquals(1, recvd[0]); assertEquals(2, recvd[1]); @@ -309,7 +309,7 @@ unitTest( { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, async function netUnixListenCloseWhileIterating(): Promise<void> { const filePath = Deno.makeTempFileSync(); - const socket = Deno.listen({ address: filePath, transport: "unix" }); + const socket = Deno.listen({ path: filePath, transport: "unix" }); const nextWhileClosing = socket[Symbol.asyncIterator]().next(); socket.close(); assertEquals(await nextWhileClosing, { value: undefined, done: true }); @@ -323,7 +323,7 @@ unitTest( { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, async function netUnixPacketListenCloseWhileIterating(): Promise<void> { const filePath = Deno.makeTempFileSync(); - const socket = Deno.listen({ address: filePath, transport: "unixpacket" }); + const socket = Deno.listen({ path: filePath, transport: "unixpacket" }); const nextWhileClosing = socket[Symbol.asyncIterator]().next(); socket.close(); assertEquals(await nextWhileClosing, { value: undefined, done: true }); |