declare module "ext:core/ops" {
import type { FileReply } from "ext:file/errors.js";
export type NetAddress =
| { readonly transport: "tcp"; readonly hostname: string; readonly port: number }
| { readonly transport: "unix"; readonly path: string | null };
export interface NetUdpAddress {
transport: "udp";
hostname: string;
port: number;
}
const listenerAddress: unique symbol;
export type NetListenerId = number & { readonly [listenerAddress]: A };
export type NetConnection = [id: number, local: A, remote: A];
export type NetListener = [id: NetListenerId, local: A];
export type NetDatagram = [id: number, local: NetUdpAddress];
export function op_net_listen(address: NetAddress & { __proto__?: null }): FileReply;
export function op_net_connect_start(address: NetAddress & { __proto__?: null }): FileReply;
export function op_net_connected(id: number): Promise>;
export function op_net_accept(id: NetListenerId): Promise>>;
export function op_net_read(args: [id: number, count: number]): Promise | null>>;
export function op_net_write(args: [id: number, bytes: Uint8Array]): Promise>;
export function op_net_writev(args: [id: number, buffers: Uint8Array[]]): Promise>;
export function op_net_shutdown(id: number): Promise>;
export function op_net_close(id: number): FileReply;
export function op_net_datagram_listen(address: NetUdpAddress & { __proto__?: null }): FileReply;
export function op_net_datagram_broadcast(args: [id: number, enabled: boolean]): FileReply;
export function op_net_datagram_receive(
args: [id: number, count: number],
): Promise, NetUdpAddress]>>;
export function op_net_datagram_send(
args: [id: number, bytes: Uint8Array, target: NetUdpAddress],
): Promise>;
}