Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,12 +846,6 @@

# End dummy list.

parser.add_argument('--with-quic',
action='store_true',
dest='quic',
default=None,
help='build with QUIC support')

parser.add_argument('--without-ssl',
action='store_true',
dest='without_ssl',
Expand Down Expand Up @@ -1826,7 +1820,6 @@ def configure_openssl(o):
variables['node_shared_ngtcp2'] = b(options.shared_ngtcp2)
variables['node_shared_nghttp3'] = b(options.shared_nghttp3)
variables['openssl_is_fips'] = b(options.openssl_is_fips)
variables['node_quic'] = b(options.quic)
variables['node_fipsinstall'] = b(False)

if options.openssl_no_asm:
Expand Down Expand Up @@ -1888,10 +1881,6 @@ def without_ssl_error(option):
if options.openssl_is_fips and not options.shared_openssl:
variables['node_fipsinstall'] = b(True)

variables['openssl_quic'] = b(options.quic)
if options.quic:
o['defines'] += ['NODE_OPENSSL_HAS_QUIC']

configure_library('openssl', o)

o['variables']['openssl_version'] = get_openssl_version(o)
Expand Down
11 changes: 11 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,16 @@ If the ES module being `require()`'d contains top-level `await`, this flag
allows Node.js to evaluate the module, try to locate the
top-level awaits, and print their location to help users find them.

### `--experimental-quic`

<!-- YAML
added: REPLACEME
-->

> Stability: 1.1 - Active development

Enable experimental support for the QUIC protocol.

### `--experimental-require-module`

<!-- YAML
Expand Down Expand Up @@ -3442,6 +3452,7 @@ one is included in the list below.
* `--experimental-loader`
* `--experimental-modules`
* `--experimental-print-required-tla`
* `--experimental-quic`
* `--experimental-require-module`
* `--experimental-shadow-realm`
* `--experimental-specifier-resolution`
Expand Down
3 changes: 3 additions & 0 deletions doc/node-config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@
"experimental-print-required-tla": {
"type": "boolean"
},
"experimental-quic": {
"type": "boolean"
},
"experimental-repl-await": {
"type": "boolean"
},
Expand Down
7 changes: 7 additions & 0 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ const features = {
get require_module() {
return getOptionValue('--experimental-require-module');
},
get quic() {
// TODO(@jasnell): When the implementation is updated to support Boring,
// then this should be refactored to depend not only on the OpenSSL version.
return !openSSLIsBoringSSL &&
getOptionValue('--experimental-quic') &&
process.config.variables.openssl_version >= 810549279; // >= 3.5.1
},
};

ObjectDefineProperty(process, 'features', {
Expand Down
11 changes: 7 additions & 4 deletions lib/internal/quic/quic.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ const {
Uint8Array,
} = primordials;

// QUIC requires that Node.js be compiled with crypto support.
const {
assertCrypto,
} = require('internal/util');
assertCrypto();
getOptionValue,
} = require('internal/options');

// QUIC requires that Node.js be compiled with crypto support.
if (!process.features.quic || !getOptionValue('--experimental-quic')) {
return;
}

const { inspect } = require('internal/util/inspect');

Expand Down
8 changes: 8 additions & 0 deletions lib/internal/quic/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ const {
JSONStringify,
} = primordials;

const {
getOptionValue,
} = require('internal/options');

if (!process.features.quic || !getOptionValue('--experimental-quic')) {
return;
}

const {
codes: {
ERR_ILLEGAL_CONSTRUCTOR,
Expand Down
8 changes: 8 additions & 0 deletions lib/internal/quic/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ const {
JSONStringify,
} = primordials;

const {
getOptionValue,
} = require('internal/options');

if (!process.features.quic || !getOptionValue('--experimental-quic')) {
return;
}

const {
isArrayBuffer,
} = require('util/types');
Expand Down
8 changes: 8 additions & 0 deletions lib/internal/quic/symbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ const {
Symbol,
} = primordials;

const {
getOptionValue,
} = require('internal/options');

if (!process.features.quic || !getOptionValue('--experimental-quic')) {
return;
}

const {
customInspectSymbol: kInspect,
} = require('internal/util');
Expand Down
62 changes: 28 additions & 34 deletions node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,22 @@
'src/udp_wrap.cc',
'src/util.cc',
'src/uv.cc',
'src/quic/bindingdata.cc',
'src/quic/cid.cc',
'src/quic/data.cc',
'src/quic/logstream.cc',
'src/quic/packet.cc',
'src/quic/preferredaddress.cc',
'src/quic/sessionticket.cc',
'src/quic/tokens.cc',
'src/quic/application.cc',
'src/quic/endpoint.cc',
'src/quic/http3.cc',
'src/quic/session.cc',
'src/quic/streams.cc',
'src/quic/tlscontext.cc',
'src/quic/transportparams.cc',
'src/quic/quic.cc',
# headers to make for a more pleasant IDE experience
'src/aliased_buffer.h',
'src/aliased_buffer-inl.h',
Expand Down Expand Up @@ -323,9 +337,22 @@
'src/udp_wrap.h',
'src/util.h',
'src/util-inl.h',
'src/quic/bindingdata.h',
'src/quic/cid.h',
'src/quic/data.h',
'src/quic/defs.h',
'src/quic/logstream.h',
'src/quic/packet.h',
'src/quic/preferredaddress.h',
'src/quic/sessionticket.h',
'src/quic/tokens.h',
'src/quic/transportparams.h',
'src/quic/application.h',
'src/quic/endpoint.h',
'src/quic/http3.h',
'src/quic/session.h',
'src/quic/streams.h',
'src/quic/tlscontext.h',
'src/quic/guard.h',
],
'node_crypto_sources': [
Expand Down Expand Up @@ -388,41 +415,13 @@
'src/node_crypto.cc',
'src/node_crypto.h',
],
'node_quic_sources': [
'src/quic/application.cc',
'src/quic/bindingdata.cc',
'src/quic/endpoint.cc',
'src/quic/http3.cc',
'src/quic/logstream.cc',
'src/quic/packet.cc',
'src/quic/preferredaddress.cc',
'src/quic/session.cc',
'src/quic/sessionticket.cc',
'src/quic/streams.cc',
'src/quic/tlscontext.cc',
'src/quic/tokens.cc',
'src/quic/transportparams.cc',
'src/quic/application.h',
'src/quic/bindingdata.h',
'src/quic/endpoint.h',
'src/quic/http3.h',
'src/quic/logstream.h',
'src/quic/packet.h',
'src/quic/preferredaddress.h',
'src/quic/session.h',
'src/quic/sessionticket.h',
'src/quic/streams.h',
'src/quic/tlscontext.h',
'src/quic/tokens.h',
'src/quic/transportparams.h',
'src/quic/quic.cc',
],
'node_cctest_openssl_sources': [
'test/cctest/test_crypto_clienthello.cc',
'test/cctest/test_node_crypto.cc',
'test/cctest/test_node_crypto_env.cc',
'test/cctest/test_quic_cid.cc',
'test/cctest/test_quic_error.cc',
'test/cctest/test_quic_preferredaddress.cc',
'test/cctest/test_quic_tokens.cc',
],
'node_cctest_inspector_sources': [
Expand Down Expand Up @@ -959,11 +958,6 @@
'deps/ncrypto/ncrypto.gyp:ncrypto',
],
}],
[ 'node_quic=="true"', {
'sources': [
'<@(node_quic_sources)',
],
}],
[ 'node_use_sqlite=="true"', {
'sources': [
'<@(node_sqlite_sources)',
Expand Down
6 changes: 0 additions & 6 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,6 @@
}],
]
}],
[ 'openssl_quic=="true" and node_shared_ngtcp2=="false"', {
'dependencies': [ './deps/ngtcp2/ngtcp2.gyp:ngtcp2' ]
}],
[ 'openssl_quic=="true" and node_shared_nghttp3=="false"', {
'dependencies': [ './deps/ngtcp2/ngtcp2.gyp:nghttp3' ]
}]
]
}, {
'defines': [ 'HAVE_OPENSSL=0' ]
Expand Down
3 changes: 2 additions & 1 deletion src/node_binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "node.h"
#define NAPI_EXPERIMENTAL
#include "node_api.h"
#include "quic/guard.h"
#include "uv.h"

enum {
Expand All @@ -30,7 +31,7 @@ static_assert(static_cast<int>(NM_F_LINKED) ==
#define NODE_BUILTIN_ICU_BINDINGS(V)
#endif

#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#if HAVE_OPENSSL && OPENSSL_NO_QUIC != 1
#define NODE_BUILTIN_QUIC_BINDINGS(V) V(quic)
#else
#define NODE_BUILTIN_QUIC_BINDINGS(V)
Expand Down
5 changes: 3 additions & 2 deletions src/node_builtins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "node_external_reference.h"
#include "node_internals.h"
#include "node_threadsafe_cow-inl.h"
#include "quic/guard.h"
#include "simdutf.h"
#include "util-inl.h"

Expand Down Expand Up @@ -137,10 +138,10 @@ BuiltinLoader::BuiltinCategories BuiltinLoader::GetBuiltinCategories() const {
"internal/http2/core", "internal/http2/compat",
"internal/streams/lazy_transform",
#endif // !HAVE_OPENSSL
#if !NODE_OPENSSL_HAS_QUIC
#ifndef OPENSSL_NO_QUIC
"internal/quic/quic", "internal/quic/symbols", "internal/quic/stats",
"internal/quic/state",
#endif // !NODE_OPENSSL_HAS_QUIC
#endif // !OPENSSL_NO_QUIC
"quic", // Experimental.
"sqlite", // Experimental.
"sys", // Deprecated.
Expand Down
3 changes: 2 additions & 1 deletion src/node_external_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <cinttypes>
#include <vector>
#include "quic/guard.h"
#include "v8-fast-api-calls.h"
#include "v8.h"

Expand Down Expand Up @@ -135,7 +136,7 @@ class ExternalReferenceRegistry {
#define EXTERNAL_REFERENCE_BINDING_LIST_CRYPTO(V)
#endif // HAVE_OPENSSL

#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
#if HAVE_OPENSSL && OPENSSL_NO_QUIC != 1
#define EXTERNAL_REFERENCE_BINDING_LIST_QUIC(V) V(quic)
#else
#define EXTERNAL_REFERENCE_BINDING_LIST_QUIC(V)
Expand Down
7 changes: 4 additions & 3 deletions src/node_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "simdjson.h"
#include "simdutf.h"
#if HAVE_SQLITE
#include "quic/guard.h"
#include "sqlite3.h"
#endif // HAVE_SQLITE
#include "undici_version.h"
Expand All @@ -30,12 +31,12 @@
#if HAVE_OPENSSL
#include <openssl/crypto.h>
#include "ncrypto.h"
#if NODE_OPENSSL_HAS_QUIC
#ifndef OPENSSL_NO_QUIC
#include <openssl/quic.h>
#endif
#endif // HAVE_OPENSSL

#ifdef NODE_OPENSSL_HAS_QUIC
#ifndef OPENSSL_NO_QUIC
#include <ngtcp2/version.h>
#include <nghttp3/version.h>
#endif
Expand Down Expand Up @@ -147,7 +148,7 @@ Metadata::Versions::Versions() {
unicode = U_UNICODE_VERSION;
#endif // NODE_HAVE_I18N_SUPPORT

#ifdef NODE_OPENSSL_HAS_QUIC
#ifndef OPENSSL_NO_QUIC
ngtcp2 = NGTCP2_VERSION;
nghttp3 = NGHTTP3_VERSION;
#endif
Expand Down
14 changes: 4 additions & 10 deletions src/node_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

#if HAVE_OPENSSL
#include <openssl/crypto.h>
#if NODE_OPENSSL_HAS_QUIC
#include <quic/guard.h>
#ifndef OPENSSL_NO_QUIC
#include <openssl/quic.h>
#endif
#endif // HAVE_OPENSSL
Expand Down Expand Up @@ -59,6 +60,8 @@ namespace node {
V(simdutf) \
V(ada) \
V(nbytes) \
V(ngtcp2) \
V(nghttp3) \
NODE_VERSIONS_KEY_AMARO(V) \
NODE_VERSIONS_KEY_UNDICI(V) \
V(cjs_module_lexer)
Expand All @@ -79,14 +82,6 @@ namespace node {
#define NODE_VERSIONS_KEY_INTL(V)
#endif // NODE_HAVE_I18N_SUPPORT

#ifdef OPENSSL_INFO_QUIC
#define NODE_VERSIONS_KEY_QUIC(V) \
V(ngtcp2) \
V(nghttp3)
#else
#define NODE_VERSIONS_KEY_QUIC(V)
#endif

#if HAVE_SQLITE
#define NODE_VERSIONS_KEY_SQLITE(V) V(sqlite)
#else
Expand All @@ -97,7 +92,6 @@ namespace node {
NODE_VERSIONS_KEYS_BASE(V) \
NODE_VERSIONS_KEY_CRYPTO(V) \
NODE_VERSIONS_KEY_INTL(V) \
NODE_VERSIONS_KEY_QUIC(V) \
NODE_VERSIONS_KEY_SQLITE(V)

#define V(key) +1
Expand Down
Loading
Loading