Ende.connect

function · requires --allow-net

function Ende.connect(options: ConnectOptions): Promise<TcpConn>

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).

const conn1 = await Ende.connect({ port: 80 });
const conn2 = await Ende.connect({ hostname: "192.0.2.1", port: 80 });
const conn3 = await Ende.connect({ hostname: "[2001:db8::1]", port: 80 });
const conn4 = await Ende.connect({ hostname: "golang.org", port: 80, transport: "tcp" });

Requires allow-net permission for "tcp".

function · requires --allow-net, --allow-read

function Ende.connect(options: UnixConnectOptions): Promise<UnixConn>

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).

const conn1 = await Ende.connect({ port: 80 });
const conn2 = await Ende.connect({ hostname: "192.0.2.1", port: 80 });
const conn3 = await Ende.connect({ hostname: "[2001:db8::1]", port: 80 });
const conn4 = await Ende.connect({ hostname: "golang.org", port: 80, transport: "tcp" });
const conn5 = await Ende.connect({ path: "/foo/bar.sock", transport: "unix" });

Requires allow-net permission for "tcp", and allow-read and allow-net for "unix". The "unix" allow-net grant may be scoped to the socket path with --allow-net=unix:<absolute-path>.

function · experimental · requires --allow-net, --allow-read

function Ende.connect(options: VsockConnectOptions): Promise<VsockConn>

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).