Network
A wide range of networking tasks, from low-level connections to high-level server creation. Handle HTTP requests, WebSocket communication, and DNS resolution. Useful for building web servers, clients, and networking tools.
Classes
Functions
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).
Establishes a secure connection over QUIC using a hostname and port. The cert file is optional and if not included Mozilla's root certificates will be used. See also https://github.com/ctz/webpki-roots for specifics.
Establishes a secure connection over TLS (transport layer security) using an optional list of CA certs, hostname (default is "127.0.0.1") and port.
Start TLS handshake from an existing connection using an optional list of CA certificates, and hostname (default is "127.0.0.1"). Specifying CA certs is optional. By default the configured root certificates are used. Using this function requires that the other end of the connection is prepared for a TLS handshake.
Interfaces
If Deno.resolveDns is called with "CAA" record type
specified, it will resolve with an array of objects with this interface.
Options which can be set when connecting via Deno.connect.
Options which can be set when establishing a TLS connection via
Deno.connectTls.
A generic transport listener for message-oriented protocols.
Options which can be set when opening a listener via
Deno.listen.
Options which can be set when opening a TLS listener via
Deno.listenTls.
If Deno.resolveDns is called with "MX" record type
specified, it will return an array of objects with this interface.
If Deno.resolveDns is called with "NAPTR" record type
specified, it will return an array of objects with this interface.
The address of a network connection or listener using an IP-based transport.
The information for a network interface returned from a call to
Deno.networkInterfaces.
An incoming connection for which the server has not yet begun its part of the handshake.
If Deno.resolveDns is called with "SOA" record type
specified, it will return an array of objects with this interface.
If Deno.resolveDns is called with "SRV" record type
specified, it will return an array of objects with this interface.
Options which can be set when upgrading an existing connection to TLS via
Deno.startTls.
Provides certified key material from strings. The key material is provided in
PEM-format (Privacy Enhanced Mail, https://www.rfc-editor.org/rfc/rfc1422) which can be identified by having
-----BEGIN----- and -----END----- markers at the beginning and end of the strings. This type of key is not compatible
with DER-format keys which are binary.
Unstable options which can be set when opening a datagram listener via
Deno.listenDatagram.
The address of a network connection or listener using a Unix domain socket.
Options which can be set when connecting to a Unix domain socket via
Deno.connect.
Unstable options which can be set when opening a unixpacket datagram
listener via Deno.listenDatagram.
Options which can be set when opening a Unix listener via
Deno.listen or Deno.listenDatagram.
The address of a network connection or listener using the VSOCK transport for communication between a virtual machine and its host.
Options which can be set when connecting over VSOCK via
Deno.connect.
Options which can be set when opening a VSOCK listener via
Deno.listen.
Type Aliases
class Deno.QuicEndpoint
Constructors #
#QuicEndpoint(options?: QuicEndpointOptions) Create a QUIC endpoint which may be used for client or server connections.
Requires allow-net permission.
Properties #
Methods #
#close(info?: QuicCloseInfo): void Closes the endpoint. All associated connections will be closed and incoming connections will be rejected.
#listen(options: QuicListenOptions): QuicListener Listen announces on the local transport address over QUIC.
function Deno.connect
Overload 1
#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 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" });
Requires allow-net permission for "tcp".
Parameters #
#options: ConnectOptions Return Type #
Promise<TcpConn> Overload 2
#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 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".
Parameters #
#options: UnixConnectOptions Return Type #
Promise<UnixConn> Overload 3
#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).
Parameters #
#options: VsockConnectOptions Return Type #
Promise<VsockConn> function Deno.connectQuic
#connectQuic<ZRTT extends boolean>(options: ConnectQuicOptions<ZRTT>): ZRTT extends true ? (QuicConn | Promise<QuicConn>) : Promise<QuicConn>Establishes a secure connection over QUIC using a hostname and port. The cert file is optional and if not included Mozilla's root certificates will be used. See also https://github.com/ctz/webpki-roots for specifics.
const caCert = await Deno.readTextFile("./certs/my_custom_root_CA.pem");
const conn1 = await Deno.connectQuic({ hostname: "example.com", port: 443, alpnProtocols: ["h3"] });
const conn2 = await Deno.connectQuic({ caCerts: [caCert], hostname: "example.com", port: 443, alpnProtocols: ["h3"] });
If an endpoint is shared among many connections, 0-RTT can be enabled. When 0-RTT is successful, a QuicConn will be synchronously returned and data can be sent immediately with it. Any data sent before the TLS handshake completes is vulnerable to replay attacks.
Requires allow-net permission.
Type Parameters #
#ZRTT extends boolean Parameters #
#options: ConnectQuicOptions<ZRTT> Return Type #
function Deno.connectTls
#connectTls(options: ConnectTlsOptions | (ConnectTlsOptions & TlsCertifiedKeyPem)): Promise<TlsConn>Establishes a secure connection over TLS (transport layer security) using an optional list of CA certs, hostname (default is "127.0.0.1") and port.
The CA cert list is optional and if not included Mozilla's root certificates will be used (see also https://github.com/ctz/webpki-roots for specifics).
Mutual TLS (mTLS or client certificates) are supported by providing a
key and cert in the options as PEM-encoded strings.
const caCert = await Deno.readTextFile("./certs/my_custom_root_CA.pem");
const conn1 = await Deno.connectTls({ port: 80 });
const conn2 = await Deno.connectTls({ caCerts: [caCert], hostname: "192.0.2.1", port: 80 });
const conn3 = await Deno.connectTls({ hostname: "[2001:db8::1]", port: 80 });
const conn4 = await Deno.connectTls({ caCerts: [caCert], hostname: "golang.org", port: 80});
const key = "----BEGIN PRIVATE KEY----...";
const cert = "----BEGIN CERTIFICATE----...";
const conn5 = await Deno.connectTls({ port: 80, key, cert });
Requires allow-net permission.
Parameters #
#options: ConnectTlsOptions | (ConnectTlsOptions & TlsCertifiedKeyPem) Return Type #
Promise<TlsConn> function Deno.listen
Overload 1
#listen(options: TcpListenOptions & { transport?: "tcp"; }): TcpListenerListen announces on the local transport address.
const listener1 = Deno.listen({ port: 80 })
const listener2 = Deno.listen({ hostname: "192.0.2.1", port: 80 })
const listener3 = Deno.listen({ hostname: "[2001:db8::1]", port: 80 });
const listener4 = Deno.listen({ hostname: "golang.org", port: 80, transport: "tcp" });
Requires allow-net permission.
Parameters #
#options: TcpListenOptions & { transport?: "tcp"; } Return Type #
Overload 2
#listen(options: UnixListenOptions & { transport: "unix"; }): UnixListenerListen announces on the local transport address.
const listener = Deno.listen({ path: "/foo/bar.sock", transport: "unix" })
Requires allow-read and allow-write permission.
Parameters #
#options: UnixListenOptions & { transport: "unix"; } Return Type #
Overload 3
#listen(options: VsockListenOptions & { transport: "vsock"; }): VsockListenerListen announces on the local transport address.
Parameters #
#options: VsockListenOptions & { transport: "vsock"; } Return Type #
function Deno.listenDatagram
Overload 1
#listenDatagram(options: UdpListenOptions & { transport: "udp"; }): DatagramConnListen announces on the local transport address.
const listener1 = Deno.listenDatagram({
port: 80,
transport: "udp"
});
const listener2 = Deno.listenDatagram({
hostname: "golang.org",
port: 80,
transport: "udp"
});
Requires allow-net permission.
Parameters #
#options: UdpListenOptions & { transport: "udp"; } Return Type #
Overload 2
#listenDatagram(options: UnixListenDatagramOptions & { transport: "unixpacket"; }): DatagramConnListen announces on the local transport address.
const listener = Deno.listenDatagram({
path: "/foo/bar.sock",
transport: "unixpacket"
});
Requires allow-read and allow-write permission.
Parameters #
#options: UnixListenDatagramOptions & { transport: "unixpacket"; } Return Type #
function Deno.listenTls
#listenTls(options: ListenTlsOptions & TlsCertifiedKeyPem): TlsListenerListen announces on the local transport address over TLS (transport layer security).
using listener = Deno.listenTls({
port: 443,
cert: Deno.readTextFileSync("./server.crt"),
key: Deno.readTextFileSync("./server.key"),
});
Requires allow-net permission.
Parameters #
#options: ListenTlsOptions & TlsCertifiedKeyPem Return Type #
function Deno.networkInterfaces
#networkInterfaces(): NetworkInterfaceInfo[]Returns an array of the network interface information.
console.log(Deno.networkInterfaces());
Requires allow-sys permission.
Return Type #
function Deno.resolveDns
Overload 1
#resolveDns(query: string,recordType: "A"
| "AAAA"
| "ANAME"
| "CNAME"
| "NS"
| "PTR",options?: ResolveDnsOptions,): Promise<string[]>Performs DNS resolution against the given query, returning resolved records.
Fails in the cases such as:
- the query is in invalid format.
- the options have an invalid parameter. For example
nameServer.portis beyond the range of 16-bit unsigned integer. - the request timed out.
const a = await Deno.resolveDns("example.com", "A");
const aaaa = await Deno.resolveDns("example.com", "AAAA", {
nameServer: { ipAddr: "8.8.8.8", port: 53 },
});
Requires allow-net permission.
Parameters #
#query: string #recordType: "A"
| "AAAA"
| "ANAME"
| "CNAME"
| "NS"
| "PTR" #options: ResolveDnsOptions Return Type #
Promise<string[]> Overload 2
#resolveDns(): Promise<CaaRecord[]>Performs DNS resolution against the given query, returning resolved records.
Fails in the cases such as:
- the query is in invalid format.
- the options have an invalid parameter. For example
nameServer.portis beyond the range of 16-bit unsigned integer. - the request timed out.
const a = await Deno.resolveDns("example.com", "A");
const aaaa = await Deno.resolveDns("example.com", "AAAA", {
nameServer: { ipAddr: "8.8.8.8", port: 53 },
});
Requires allow-net permission.
Parameters #
Return Type #
Promise<CaaRecord[]> Overload 3
#resolveDns(): Promise<MxRecord[]>Performs DNS resolution against the given query, returning resolved records.
Fails in the cases such as:
- the query is in invalid format.
- the options have an invalid parameter. For example
nameServer.portis beyond the range of 16-bit unsigned integer. - the request timed out.
const a = await Deno.resolveDns("example.com", "A");
const aaaa = await Deno.resolveDns("example.com", "AAAA", {
nameServer: { ipAddr: "8.8.8.8", port: 53 },
});
Requires allow-net permission.
Parameters #
Return Type #
Promise<MxRecord[]> Overload 4
#resolveDns(): Promise<NaptrRecord[]>Performs DNS resolution against the given query, returning resolved records.
Fails in the cases such as:
- the query is in invalid format.
- the options have an invalid parameter. For example
nameServer.portis beyond the range of 16-bit unsigned integer. - the request timed out.
const a = await Deno.resolveDns("example.com", "A");
const aaaa = await Deno.resolveDns("example.com", "AAAA", {
nameServer: { ipAddr: "8.8.8.8", port: 53 },
});
Requires allow-net permission.
Parameters #
Return Type #
Promise<NaptrRecord[]> Overload 5
#resolveDns(): Promise<SoaRecord[]>Performs DNS resolution against the given query, returning resolved records.
Fails in the cases such as:
- the query is in invalid format.
- the options have an invalid parameter. For example
nameServer.portis beyond the range of 16-bit unsigned integer. - the request timed out.
const a = await Deno.resolveDns("example.com", "A");
const aaaa = await Deno.resolveDns("example.com", "AAAA", {
nameServer: { ipAddr: "8.8.8.8", port: 53 },
});
Requires allow-net permission.
Parameters #
Return Type #
Promise<SoaRecord[]> Overload 6
#resolveDns(): Promise<SrvRecord[]>Performs DNS resolution against the given query, returning resolved records.
Fails in the cases such as:
- the query is in invalid format.
- the options have an invalid parameter. For example
nameServer.portis beyond the range of 16-bit unsigned integer. - the request timed out.
const a = await Deno.resolveDns("example.com", "A");
const aaaa = await Deno.resolveDns("example.com", "AAAA", {
nameServer: { ipAddr: "8.8.8.8", port: 53 },
});
Requires allow-net permission.
Parameters #
Return Type #
Promise<SrvRecord[]> Overload 7
#resolveDns(): Promise<string[][]>Performs DNS resolution against the given query, returning resolved records.
Fails in the cases such as:
- the query is in invalid format.
- the options have an invalid parameter. For example
nameServer.portis beyond the range of 16-bit unsigned integer. - the request timed out.
const a = await Deno.resolveDns("example.com", "A");
const aaaa = await Deno.resolveDns("example.com", "AAAA", {
nameServer: { ipAddr: "8.8.8.8", port: 53 },
});
Requires allow-net permission.
Parameters #
Return Type #
Promise<string[][]> Overload 8
#resolveDns(): Promise<>Performs DNS resolution against the given query, returning resolved records.
Fails in the cases such as:
- the query is in invalid format.
- the options have an invalid parameter. For example
nameServer.portis beyond the range of 16-bit unsigned integer. - the request timed out.
const a = await Deno.resolveDns("example.com", "A");
const aaaa = await Deno.resolveDns("example.com", "AAAA", {
nameServer: { ipAddr: "8.8.8.8", port: 53 },
});
Requires allow-net permission.
Parameters #
Return Type #
Promise<> function Deno.startTls
#startTls(conn: TcpConn,options?: StartTlsOptions,): Promise<TlsConn>Start TLS handshake from an existing connection using an optional list of CA certificates, and hostname (default is "127.0.0.1"). Specifying CA certs is optional. By default the configured root certificates are used. Using this function requires that the other end of the connection is prepared for a TLS handshake.
Note that this function consumes the TCP connection passed to it, thus the
original TCP connection will be unusable after calling this. Additionally,
you need to ensure that the TCP connection is not being used elsewhere when
calling this function in order for the TCP connection to be consumed properly.
For instance, if there is a Promise that is waiting for read operation on
the TCP connection to complete, it is considered that the TCP connection is
being used elsewhere. In such a case, this function will fail.
const conn = await Deno.connect({ port: 80, hostname: "127.0.0.1" });
const caCert = await Deno.readTextFile("./certs/my_custom_root_CA.pem");
// `conn` becomes unusable after calling `Deno.startTls`
const tlsConn = await Deno.startTls(conn, { caCerts: [caCert], hostname: "localhost" });
Requires allow-net permission.
Parameters #
#options: StartTlsOptions Return Type #
Promise<TlsConn> interface Deno.CaaRecord
If Deno.resolveDns is called with "CAA" record type
specified, it will resolve with an array of objects with this interface.
Properties #
If true, indicates that the corresponding property tag must be
understood if the semantics of the CAA record are to be correctly
interpreted by an issuer.
Issuers must not issue certificates for a domain if the relevant CAA
Resource Record set contains unknown property tags that have critical
set.
interface Deno.Conn
A generic stream-oriented network connection that can be read from and written to.
Type Parameters #
Properties #
#remoteAddr: A The remote address of the connection.
A ReadableStream of the data received over the connection.
Methods #
Read the incoming data from the connection into an array buffer (p).
Resolves to either the number of bytes read during the operation or EOF
(null) if there was nothing more to read.
It is possible for a read to successfully return with 0 bytes. This
does not indicate EOF.
It is not guaranteed that the full buffer will be read in a single call.
// If the text "hello world" is received by the client:
const conn = await Deno.connect({ hostname: "example.com", port: 80 });
const buf = new Uint8Array(100);
const numberOfBytesRead = await conn.read(buf); // 11 bytes
const text = new TextDecoder().decode(buf); // "hello world"
Write the contents of the array buffer (p) to the connection.
Resolves to the number of bytes written.
It is not guaranteed that the full buffer will be written in a single call.
const conn = await Deno.connect({ hostname: "example.com", port: 80 });
const encoder = new TextEncoder();
const data = encoder.encode("Hello world");
const bytesWritten = await conn.write(data); // 11
Closes the connection, freeing the resource.
const conn = await Deno.connect({ hostname: "example.com", port: 80 });
// ...
conn.close();
#closeWrite(): Promise<void> Shuts down (shutdown(2)) the write side of the connection. Most
callers should just use close().
Make the connection block the event loop from finishing.
Note: the connection blocks the event loop from finishing by default.
This method is only meaningful after .unref() is called.
interface Deno.ConnectOptions
Options which can be set when connecting via Deno.connect.
Properties #
A literal IP address or host name that can be resolved to an IP address. If not specified,
interface Deno.ConnectQuicOptions
Type Parameters #
#ZRTT extends boolean Properties #
#serverName: string | undefined The name used for validating the certificate provided by the server. If
not provided, defaults to hostname.
#alpnProtocols: string[] Application-Layer Protocol Negotiation (ALPN) protocols supported by the client. QUIC requires the use of ALPN.
A list of root certificates that will be used in addition to the default root certificates to verify the peer's certificate.
Must be in PEM format.
#endpoint: QuicEndpoint If no endpoint is provided, a new one is bound on an ephemeral port.
interface Deno.ConnectTlsOptions
Options which can be set when establishing a TLS connection via
Deno.connectTls.
Properties #
A literal IP address or host name that can be resolved to an IP address.
A list of root certificates that will be used in addition to the default root certificates to verify the peer's certificate.
Must be in PEM format.
#alpnProtocols: string[] Application-Layer Protocol Negotiation (ALPN) protocols supported by the client. If not specified, no ALPN extension will be included in the TLS handshake.
#unsafelyDisableHostnameVerification: boolean = false If true, the certificate's common name or subject alternative names will not be checked against the hostname provided in the options.
This disables hostname verification but still validates the certificate chain. Use with caution and only when connecting to known servers.
interface Deno.DatagramConn
A generic transport listener for message-oriented protocols.
Properties #
Methods #
#joinMulticastV4(address: string,networkInterface: string,): Promise<MulticastV4Membership> Joins an IPv4 multicast group.
#joinMulticastV6(address: string,networkInterface: number,): Promise<MulticastV6Membership> Joins an IPv6 multicast group.
Waits for and resolves to the next message to the instance.
Messages are received in the format of a tuple containing the data array and the address information.
Sends a message to the target via the connection. The method resolves with the number of bytes sent.
#[[Symbol.asyncIterator]](): AsyncIterableIterator<[Uint8Array<ArrayBuffer>, Addr]> interface Deno.Listener
A generic network listener for stream-oriented protocols.
Type Parameters #
Properties #
Methods #
Close closes the listener. Any pending accept promises will be rejected
with errors. A pending async iterator next() call will settle after the
underlying accept promise is rejected.
If the listener has a pending accept operation, the underlying socket may
not be released until the pending promise is rejected. If you need to
listen on the same address immediately after closing the listener, await
the pending accept promise before calling Deno.listen again.
#[[Symbol.asyncIterator]](): AsyncIterableIterator<T> Iterates over the connections accepted by the listener.
Make the listener block the event loop from finishing.
Note: the listener blocks the event loop from finishing by default.
This method is only meaningful after .unref() is called.
interface Deno.ListenOptions
Options which can be set when opening a listener via
Deno.listen.
Properties #
A literal IP address or host name that can be resolved to an IP address.
Note about 0.0.0.0 While listening 0.0.0.0 works on all platforms,
the browsers on Windows don't work with the address 0.0.0.0.
You should show the message like server running on localhost:8080 instead of
server running on 0.0.0.0:8080 if your program supports Windows.
#tcpBacklog: number = 511 Maximum number of pending connections in the listen queue.
This parameter controls how many incoming connections can be queued by the operating system while waiting for the application to accept them. If more connections arrive when the queue is full, they will be refused.
The kernel may adjust this value (e.g., rounding up to the next power of 2 plus 1). Different operating systems have different maximum limits.
interface Deno.ListenTlsOptions
Options which can be set when opening a TLS listener via
Deno.listenTls.
Properties #
#alpnProtocols: string[] Application-Layer Protocol Negotiation (ALPN) protocols to announce to the client. If not specified, no ALPN extension will be included in the TLS handshake.
interface Deno.MulticastV4Membership
Represents membership of a IPv4 multicast group.
Properties #
#setLoopback: (loopback: boolean) => Promise<void> Sets the multicast loopback option. If enabled, multicast packets will be looped back to the local socket.
interface Deno.MulticastV6Membership
Represents membership of a IPv6 multicast group.
Properties #
#setLoopback: (loopback: boolean) => Promise<void> Sets the multicast loopback option. If enabled, multicast packets will be looped back to the local socket.
interface Deno.MxRecord
If Deno.resolveDns is called with "MX" record type
specified, it will return an array of objects with this interface.
Properties #
#preference: number A priority value, which is a relative value compared to the other preferences of MX records for the domain.
interface Deno.NaptrRecord
If Deno.resolveDns is called with "NAPTR" record type
specified, it will return an array of objects with this interface.
Properties #
interface Deno.NetworkInterfaceInfo
The information for a network interface returned from a call to
Deno.networkInterfaces.
Properties #
interface Deno.QuicAcceptOptions
Type Parameters #
#ZRTT extends boolean Properties #
#alpnProtocols: string[] Application-Layer Protocol Negotiation (ALPN) protocols to announce to the client. QUIC requires the use of ALPN.
interface Deno.QuicBidirectionalStream
Properties #
#readable: QuicReceiveStream Returns a QuicReceiveStream instance that can be used to read incoming data.
#writable: QuicSendStream Returns a QuicSendStream instance that can be used to write outgoing data.
interface Deno.QuicConn
Properties #
#endpoint: QuicEndpoint The endpoint for this connection.
Returns a promise that resolves when the TLS handshake is complete.
#remoteAddr: NetAddr Return the remote address for the connection. Clients may change addresses at will, for example when switching to a cellular internet connection.
The negotiated ALPN protocol, if provided. Only available after the handshake is complete.
#serverName: string | undefined The negotiated server name. Only available on the server after the handshake is complete.
#closed: Promise<QuicCloseInfo> Returns a promise that resolves when the connection is closed.
#incomingBidirectionalStreams: ReadableStream<QuicBidirectionalStream> A stream of bidirectional streams opened by the peer.
#incomingUnidirectionalStreams: ReadableStream<QuicReceiveStream> A stream of unidirectional streams opened by the peer.
#maxDatagramSize: number Returns the datagram stream for sending and receiving datagrams.
Methods #
#close(info?: QuicCloseInfo): void Close closes the listener. Any pending accept promises will be rejected with errors.
#createBidirectionalStream(options?: QuicSendStreamOptions): Promise<QuicBidirectionalStream> Opens and returns a bidirectional stream.
#createUnidirectionalStream(options?: QuicSendStreamOptions): Promise<QuicSendStream> Opens and returns a unidirectional stream.
#sendDatagram(data: Uint8Array): Promise<void> Send a datagram. The provided data cannot be larger than
maxDatagramSize.
#readDatagram(): Promise<Uint8Array<ArrayBuffer>> Receive a datagram.
interface Deno.QuicIncoming
An incoming connection for which the server has not yet begun its part of the handshake.
Properties #
The local IP address which was used when the peer established the connection.
#remoteAddr: NetAddr The peer’s UDP address.
#remoteAddressValidated: boolean Whether the socket address that is initiating this connection has proven that they can receive traffic.
Methods #
interface Deno.QuicListener
Specialized listener that accepts QUIC connections.
Properties #
#endpoint: QuicEndpoint The endpoint for this listener.
Methods #
#incoming(): Promise<QuicIncoming> Waits for and resolves to the next incoming connection.
#[[Symbol.asyncIterator]](): AsyncIterableIterator<QuicIncoming> Iterates over the incoming connections received by the listener.
interface Deno.QuicSendStreamOptions
Properties #
Indicates the send priority of this stream relative to other streams for which the value has been set.
#waitUntilAvailable: boolean = false Wait until there is sufficient flow credit to create the stream.
interface Deno.QuicServerTransportOptions
Properties #
#preferredAddressV4: string = undefined Preferred IPv4 address to be communicated to the client during handshaking. If the client is able to reach this address it will switch to it.
#preferredAddressV6: string = undefined Preferred IPv6 address to be communicated to the client during handshaking. If the client is able to reach this address it will switch to it.
interface Deno.QuicTransportOptions
Properties #
#keepAliveInterval: number = undefined Period of inactivity before sending a keep-alive packet. Keep-alive packets prevent an inactive but otherwise healthy connection from timing out. Only one side of any given connection needs keep-alive enabled for the connection to be preserved.
#maxIdleTimeout: number = undefined Maximum duration of inactivity to accept before timing out the connection. The true idle timeout is the minimum of this and the peer’s own max idle timeout.
#maxConcurrentBidirectionalStreams: number = 100 Maximum number of incoming bidirectional streams that may be open concurrently.
#maxConcurrentUnidirectionalStreams: number = 100 Maximum number of incoming unidirectional streams that may be open concurrently.
#congestionControl: "throughput"
| "low-latency"
| "default" = "default" The congestion control algorithm used when sending data over this connection.
interface Deno.ResolveDnsOptions
Options which can be set when using Deno.resolveDns.
Properties #
#nameServer: { ipAddr: string; port?: number; } The name server to be used for lookups.
If not specified, defaults to the system configuration. For example
/etc/resolv.conf on Unix-like systems.
interface Deno.StartTlsOptions
Options which can be set when upgrading an existing connection to TLS via
Deno.startTls.
Properties #
A literal IP address or host name that can be resolved to an IP address.
A list of root certificates that will be used in addition to the default root certificates to verify the peer's certificate.
Must be in PEM format.
#alpnProtocols: string[] Application-Layer Protocol Negotiation (ALPN) protocols to announce to the client. If not specified, no ALPN extension will be included in the TLS handshake.
#unsafelyDisableHostnameVerification: boolean = false If true, the certificate's common name or subject alternative names will not be checked against the hostname provided in the options.
This disables hostname verification but still validates the certificate chain. Use with caution and only when connecting to known servers.
interface Deno.TcpConn
A TCP stream connection.
Methods #
#setNoDelay(noDelay?: boolean): void Enable/disable the use of Nagle's algorithm.
#setKeepAlive(keepAlive?: boolean): void Enable/disable keep-alive functionality.
interface Deno.TcpListenOptions
Properties #
When true the SO_REUSEPORT flag will be set on the listener. This
allows multiple processes to listen on the same address and port.
On Linux this will cause the kernel to distribute incoming connections across the different processes that are listening on the same address and port.
This flag is only supported on Linux. It is silently ignored on other platforms.
Options which can be set when opening a TCP listener via
Deno.listen.
interface Deno.TlsCertifiedKeyPem
Provides certified key material from strings. The key material is provided in
PEM-format (Privacy Enhanced Mail, https://www.rfc-editor.org/rfc/rfc1422) which can be identified by having
-----BEGIN----- and -----END----- markers at the beginning and end of the strings. This type of key is not compatible
with DER-format keys which are binary.
Deno supports RSA, EC, and PKCS8-format keys.
const key = {
key: "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n",
cert: "-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----\n" }
};
Properties #
interface Deno.TlsConn
A TLS-encrypted stream connection over an IP-based transport.
Methods #
#handshake(): Promise<TlsHandshakeInfo> Runs the client or server handshake protocol to completion if that has not happened yet. Calling this method is optional; the TLS handshake will be completed automatically as soon as data is sent or received.
interface Deno.TlsHandshakeInfo
Information about a completed TLS handshake.
Properties #
#alpnProtocol: string | null Contains the ALPN protocol selected during negotiation with the server.
If no ALPN protocol selected, returns null.
interface Deno.UdpListenOptions
Unstable options which can be set when opening a datagram listener via
Deno.listenDatagram.
Properties #
#reuseAddress: boolean = false When true the specified address will be reused, even if another
process has already bound a socket on it. This effectively steals the
socket from the listener.
interface Deno.UnixConnectOptions
interface Deno.UnixListenDatagramOptions
Unstable options which can be set when opening a unixpacket datagram
listener via Deno.listenDatagram.
Properties #
interface Deno.UnixListenOptions
Options which can be set when opening a Unix listener via
Deno.listen or Deno.listenDatagram.
Properties #
interface Deno.VsockAddr
interface Deno.VsockConnectOptions
interface Deno.VsockListenOptions
type alias Deno.RecordType
The type of the resource record to resolve via DNS using
Deno.resolveDns.
Only the listed types are supported currently.
Definition #
"A"
| "AAAA"
| "ANAME"
| "CAA"
| "CNAME"
| "MX"
| "NAPTR"
| "NS"
| "PTR"
| "SOA"
| "SRV"
| "TXT"