Skip to content

Commit

Permalink
quic: add quic
Browse files Browse the repository at this point in the history
Signed-off-by: James M Snell <jasnell@gmail.com>
  • Loading branch information
jasnell committed Apr 17, 2021
1 parent 6abf25e commit 464bef2
Show file tree
Hide file tree
Showing 27 changed files with 14,932 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/api/index.md
Expand Up @@ -47,6 +47,7 @@
* [Process](process.md)
* [Punycode](punycode.md)
* [Query strings](querystring.md)
* [QUIC](quic.md)
* [Readline](readline.md)
* [REPL](repl.md)
* [Report](report.md)
Expand Down
104 changes: 104 additions & 0 deletions doc/api/quic.md
@@ -0,0 +1,104 @@
# QUIC

## Overview

## API

### Class: `net.quic.EndpointConfig`

#### `new net.quic.EndpointConfig(options)`

* `options` {Object}
* `address` {Object|net.SocketAddress} Identifies the local IPv4 or IPv6
address to bind to.
* `address` {string} The network address as either an IPv4 or IPv6 string.
**Default**: `'127.0.0.1'` if `family` is `'ipv4'`; `'::'` if `family` is
`'ipv6'`.
* `family` {string} One of either `'ipv4'` or 'ipv6'`.
**Default**: `'ipv4'`.
* `flowlabel` {number} An IPv6 flow-label used only if `family` is `'ipv6'`.
* `port` {number} An IP port.
* `retryTokenExpiration` {number|bigint}
* `tokenExpiration` {number|bigint}
* `maxWindowOverride` {number|bigint}
* `maxStreamWindowOverride` {number|bigint}
* `maxConnectionsPerHost` {number|bigint}
* `maxConnectionsTotal` {number|bigint}
* `maxStatelessResets` {number|bigint}
* `addressLRUSize` {number|bigint}
* `retryLimit` {number|bigint}
* `maxPayloadSize` {number|bigint}
* `unacknowledgedPacketThreshold` {number|bigint}
* `qlog` {boolean}
* `validateAddress` {boolean}
* `disableStatelessReset` {boolean}
* `rxPacketLoss` {number}
* `txPacketLoss` {number}
* `ccAlgorithm` {string} One of either `'cubic'` or `'reno'`.
* `udp` {Object}
* `ipv6Only` {boolean}
* `receiveBufferSize` {number}
* `sendBufferSize` {number}
* `ttl` {number}
* `resetTokenSecret` {ArrayBuffer|TypedArray|DataView|Buffer}

### Class: `net.quic.SessionConfig`

#### `new net.quic.SessionConfig(side, options)`

* `side` {String} One of `'client'` or `'server'`
* `options` {Object}
* `alpn` {string}
* `dcid` {string|ArrayBuffer|TypedArray|DataView|Buffer}
* `hostname` {string}
* `preferredAddressStrategy` {string} One of `'use'` or `'ignore'`
* `secure` {Object}
* `ca` {string|string[]|Buffer|Buffer[]}
* `cert` {string|string[]|Buffer|Buffer[]}
* `sigalgs` {string}
* `ciphers` {string}
* `clientCertEngine` {string}
* `crl` {string|string[]|Buffer|Buffer[]}
* `dhparam` {string|Buffer}
* `ecdhCurve` {string}
* `key` {string|string[]|Buffer|Buffer[]|Object[]}
* `privateKey` {Object}
* `engine` {string}
* `identifier` {string}
* `passphrase` {string}
* `pfx` {string|string[]|Buffer|Buffer[]|Object[]}
* `secureOptions`
* `sessionIdContext` {string}
* `ticketKeys` {Buffer}
* `sessionTimeout` {number}
* `enableTLSTrace` {boolean}
* `handshakeTimeout` {number}
* `minDHSize` {number}
* `pskCallback` {Function}
* `socket` {tls.TLSSocket}
* `identity` {string}
* Returns: {Buffer|TypedArray|DataView}
* `rejectUnauthorized` {boolean}
* `requestOCSP` {boolean}
* `requestPeerCertificate` {boolean}
* `verifyHostnameIdentity` {boolean}
* `transportParams` {Object}
* `initialMaxStreamDataBidiLocal` {number|bigint}
* `initialMaxStreamDataBidiRemote` {number|bigint}
* `initialMaxStreamDataUni` {number|bigint}
* `initialMaxData` {number|bigint}
* `initialMaxStreamsBidi` {number|bigint}
* `initialMaxStreamsUni` {number|bigint}
* `maxIdleTimeout` {number|bigint}
* `activeConnectionIdLimit` {number|bigint}
* `ackDelayExponent` {number|bigint}
* `maxAckDelay` {number|bigint}
* `maxDatagramFrameSize` {number|bigint}
* `disableActiveMigration` {boolean}
* `preferredAddress` {Object}
* `ipv4` {Object|net.SocketAddress}
* `address` {string}
* `port` {number}
* `ipv6` {Object|net.SocketAddress}
* `address` {string}
* `port` {number}
98 changes: 98 additions & 0 deletions lib/internal/quic/binding.js
@@ -0,0 +1,98 @@
'use strict';

const {
initializeCallbacks,
} = internalBinding('quic');

const {
symbols: {
owner_symbol,
},
} = require('internal/async_hooks');

// If the initializeCallbacks is undefined, the Node.js binary
// was built without QUIC support, in which case we
// don't want to export anything here.
if (initializeCallbacks === undefined)
return;

// For the list of required callbacks, see the QUIC_JS_CALLBACKS
// macro in src/quic/quic.h

function onEndpointClose(context, status) {}

function onEndpointDone() {
this[owner_symbol].destroy();
}

function onEndpointError() {}

function onSessionNew() {}

function onSessionCert() {}

function onSessionClientHello() {}

function onSessionClose() {}

function onSessionDatagram() {}

function onSessionHandshake() {}

function onSessionKeylog() {}

function onSessionPathValidation() {}

function onSessionUsePreferredAddress() {}

function onSessionQlog() {}

function onSessionOcspRequest() {}

function onSessionOcspResponse() {}

function onSessionTicket() {}

function onSessionVersionNegotiation() {}

function onStreamClose() {}

function onStreamError() {}

function onStreamReady() {}

function onStreamReset() {}

function onStreamHeaders() {}

function onStreamBlocked() {}

module.exports = {
initializeBinding() {
initializeCallbacks({
onEndpointClose,
onEndpointDone,
onEndpointError,
onSessionNew,
onSessionCert,
onSessionClientHello,
onSessionClose,
onSessionDatagram,
onSessionHandshake,
onSessionKeylog,
onSessionPathValidation,
onSessionUsePreferredAddress,
onSessionQlog,
onSessionOcspRequest,
onSessionOcspResponse,
onSessionTicket,
onSessionVersionNegotiation,
onStreamClose,
onStreamError,
onStreamReady,
onStreamReset,
onStreamHeaders,
onStreamBlocked,
});
}
};

0 comments on commit 464bef2

Please sign in to comment.