Skip to content

Commit 5536044

Browse files
committed
quic: initial QUIC implementation
Co-authored-by: Anna Henningsen <anna@addaleax.net> Co-authored-by: Daniel Bevenius <daniel.bevenius@gmail.com> Co-authored-by: gengjiawen <technicalcute@gmail.com> Co-authored-by: James M Snell <jasnell@gmail.com> Co-authored-by: Lucas Pardue <lucaspardue.24.7@gmail.com> Co-authored-by: Ouyang Yadong <oyydoibh@gmail.com> Co-authored-by: Juan Jos<C3><A9> Arboleda <soyjuanarbol@gmail.com> Co-authored-by: Trivikram Kamat <trivikr.dev@gmail.com> Co-authored-by: Denys Otrishko <shishugi@gmail.com> PR-URL: #32379 Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent bccb514 commit 5536044

File tree

102 files changed

+25305
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+25305
-15
lines changed

LICENSE

+52
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,58 @@ The externally maintained libraries used by Node.js are:
13161316
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
13171317
"""
13181318

1319+
- ngtcp2, located at deps/ngtcp2, is licensed as follows:
1320+
"""
1321+
The MIT License
1322+
1323+
Copyright (c) 2016 ngtcp2 contributors
1324+
1325+
Permission is hereby granted, free of charge, to any person obtaining
1326+
a copy of this software and associated documentation files (the
1327+
"Software"), to deal in the Software without restriction, including
1328+
without limitation the rights to use, copy, modify, merge, publish,
1329+
distribute, sublicense, and/or sell copies of the Software, and to
1330+
permit persons to whom the Software is furnished to do so, subject to
1331+
the following conditions:
1332+
1333+
The above copyright notice and this permission notice shall be
1334+
included in all copies or substantial portions of the Software.
1335+
1336+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1337+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1338+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1339+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1340+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1341+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1342+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1343+
"""
1344+
1345+
- nghttp3, located at deps/nghttp3, is licensed as follows:
1346+
"""
1347+
The MIT License
1348+
1349+
Copyright (c) 2019 nghttp3 contributors
1350+
1351+
Permission is hereby granted, free of charge, to any person obtaining
1352+
a copy of this software and associated documentation files (the
1353+
"Software"), to deal in the Software without restriction, including
1354+
without limitation the rights to use, copy, modify, merge, publish,
1355+
distribute, sublicense, and/or sell copies of the Software, and to
1356+
permit persons to whom the Software is furnished to do so, subject to
1357+
the following conditions:
1358+
1359+
The above copyright notice and this permission notice shall be
1360+
included in all copies or substantial portions of the Software.
1361+
1362+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1363+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
1364+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1365+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
1366+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
1367+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
1368+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1369+
"""
1370+
13191371
- node-inspect, located at deps/node-inspect, is licensed as follows:
13201372
"""
13211373
Copyright Node.js contributors. All rights reserved.

configure.py

+57
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@
122122
dest='error_on_warn',
123123
help='Turn compiler warnings into errors for node core sources.')
124124

125+
parser.add_option('--experimental-quic',
126+
action='store_true',
127+
dest='experimental_quic',
128+
help='enable experimental quic support')
129+
125130
parser.add_option('--gdb',
126131
action='store_true',
127132
dest='gdb',
@@ -269,6 +274,48 @@
269274
dest='shared_nghttp2_libpath',
270275
help='a directory to search for the shared nghttp2 DLLs')
271276

277+
shared_optgroup.add_option('--shared-ngtcp2',
278+
action='store_true',
279+
dest='shared_ngtcp2',
280+
help='link to a shared ngtcp2 DLL instead of static linking')
281+
282+
shared_optgroup.add_option('--shared-ngtcp2-includes',
283+
action='store',
284+
dest='shared_ngtcp2_includes',
285+
help='directory containing ngtcp2 header files')
286+
287+
shared_optgroup.add_option('--shared-ngtcp2-libname',
288+
action='store',
289+
dest='shared_ngtcp2_libname',
290+
default='ngtcp2',
291+
help='alternative lib name to link to [default: %default]')
292+
293+
shared_optgroup.add_option('--shared-ngtcp2-libpath',
294+
action='store',
295+
dest='shared_ngtcp2_libpath',
296+
help='a directory to search for the shared ngtcp2 DLLs')
297+
298+
shared_optgroup.add_option('--shared-nghttp3',
299+
action='store_true',
300+
dest='shared_nghttp3',
301+
help='link to a shared nghttp3 DLL instead of static linking')
302+
303+
shared_optgroup.add_option('--shared-nghttp3-includes',
304+
action='store',
305+
dest='shared_nghttp3_includes',
306+
help='directory containing nghttp3 header files')
307+
308+
shared_optgroup.add_option('--shared-nghttp3-libname',
309+
action='store',
310+
dest='shared_nghttp3_libname',
311+
default='nghttp3',
312+
help='alternative lib name to link to [default: %default]')
313+
314+
shared_optgroup.add_option('--shared-nghttp3-libpath',
315+
action='store',
316+
dest='shared_nghttp3_libpath',
317+
help='a directory to search for the shared nghttp3 DLLs')
318+
272319
shared_optgroup.add_option('--shared-openssl',
273320
action='store_true',
274321
dest='shared_openssl',
@@ -1178,6 +1225,14 @@ def configure_node(o):
11781225
else:
11791226
o['variables']['debug_nghttp2'] = 'false'
11801227

1228+
if options.experimental_quic:
1229+
if options.shared_openssl:
1230+
raise Exception('QUIC requires a modified version of OpenSSL and '
1231+
'cannot be enabled when using --shared-openssl.')
1232+
o['variables']['experimental_quic'] = 1
1233+
else:
1234+
o['variables']['experimental_quic'] = 'false'
1235+
11811236
o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)
11821237

11831238
o['variables']['node_shared'] = b(options.shared)
@@ -1309,6 +1364,8 @@ def without_ssl_error(option):
13091364
without_ssl_error('--openssl-fips')
13101365
if options.openssl_default_cipher_list:
13111366
without_ssl_error('--openssl-default-cipher-list')
1367+
if options.experimental_quic:
1368+
without_ssl_error('--experimental-quic')
13121369
return
13131370

13141371
if options.use_openssl_ca_store:

deps/openssl/openssl.gyp

+7
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@
1616
'OPENSSL_NO_HW',
1717
],
1818
'conditions': [
19+
[
20+
# Disable building QUIC support in openssl if experimental_quic
21+
# is not enabled.
22+
'experimental_quic!=1', {
23+
'defines': ['OPENSSL_NO_QUIC=1'],
24+
}
25+
],
1926
[ 'openssl_no_asm==1', {
2027
'includes': ['./openssl_no_asm.gypi'],
2128
}, 'target_arch=="arm64" and OS=="win"', {

doc/api/errors.md

+119
Original file line numberDiff line numberDiff line change
@@ -1717,6 +1717,125 @@ Accessing `Object.prototype.__proto__` has been forbidden using
17171717
[`Object.setPrototypeOf`][] should be used to get and set the prototype of an
17181718
object.
17191719

1720+
<a id="ERR_QUIC_CANNOT_SET_GROUPS"></a>
1721+
### `ERR_QUIC_CANNOT_SET_GROUPS`
1722+
1723+
> Stability: 1 - Experimental
1724+
1725+
TBD
1726+
1727+
<a id="ERR_QUIC_ERROR"></a>
1728+
### `ERR_QUIC_ERROR`
1729+
1730+
> Stability: 1 - Experimental
1731+
1732+
TBD
1733+
1734+
<a id="ERR_QUIC_TLS13_REQUIRED"></a>
1735+
### `ERR_QUIC_TLS13_REQUIRED`
1736+
1737+
> Stability: 1 - Experimental
1738+
1739+
TBD
1740+
1741+
<a id="ERR_QUICCLIENTSESSION_FAILED"></a>
1742+
### `ERR_QUICCLIENTSESSION_FAILED`
1743+
1744+
> Stability: 1 - Experimental
1745+
1746+
TBD
1747+
1748+
<a id="ERR_QUICCLIENTSESSION_FAILED_SETSOCKET"></a>
1749+
### `ERR_QUICCLIENTSESSION_FAILED_SETSOCKET`
1750+
1751+
> Stability: 1 - Experimental
1752+
1753+
TBD
1754+
1755+
<a id="ERR_QUICSESSION_DESTROYED"></a>
1756+
### `ERR_QUICSESSION_DESTROYED`
1757+
1758+
> Stability: 1 - Experimental
1759+
1760+
TBD
1761+
1762+
<a id="ERR_QUICSESSION_INVALID_DCID"></a>
1763+
### `ERR_QUICSESSION_INVALID_DCID`
1764+
1765+
> Stability: 1 - Experimental
1766+
1767+
TBD
1768+
1769+
<a id="ERR_QUICSESSION_UPDATEKEY"></a>
1770+
### `ERR_QUICSESSION_UPDATEKEY`
1771+
1772+
> Stability: 1 - Experimental
1773+
1774+
TBD
1775+
1776+
<a id="ERR_QUICSESSION_VERSION_NEGOTIATION"></a>
1777+
### `ERR_QUICSESSION_VERSION_NEGOTIATION`
1778+
1779+
> Stability: 1 - Experimental
1780+
1781+
TBD
1782+
1783+
<a id="ERR_QUICSOCKET_DESTROYED"></a>
1784+
### `ERR_QUICSOCKET_DESTROYED`
1785+
1786+
> Stability: 1 - Experimental
1787+
1788+
TBD
1789+
1790+
<a id="ERR_QUICSOCKET_INVALID_STATELESS_RESET_SECRET_LENGTH"></a>
1791+
### `ERR_QUICSOCKET_INVALID_STATELESS_RESET_SECRET_LENGTH`
1792+
1793+
> Stability: 1 - Experimental
1794+
1795+
TBD
1796+
1797+
<a id="ERR_QUICSOCKET_LISTENING"></a>
1798+
### `ERR_QUICSOCKET_LISTENING`
1799+
1800+
> Stability: 1 - Experimental
1801+
1802+
TBD
1803+
1804+
<a id="ERR_QUICSOCKET_UNBOUND"></a>
1805+
### `ERR_QUICSOCKET_UNBOUND`
1806+
1807+
> Stability: 1 - Experimental
1808+
1809+
TBD
1810+
1811+
<a id="ERR_QUICSTREAM_DESTROYED"></a>
1812+
### `ERR_QUICSTREAM_DESTROYED`
1813+
1814+
> Stability: 1 - Experimental
1815+
1816+
TBD
1817+
1818+
<a id="ERR_QUICSTREAM_INVALID_PUSH"></a>
1819+
### `ERR_QUICSTREAM_INVALID_PUSH`
1820+
1821+
> Stability: 1 - Experimental
1822+
1823+
TBD
1824+
1825+
<a id="ERR_QUICSTREAM_OPEN_FAILED"></a>
1826+
### `ERR_QUICSTREAM_OPEN_FAILED`
1827+
1828+
> Stability: 1 - Experimental
1829+
1830+
TBD
1831+
1832+
<a id="ERR_QUICSTREAM_UNSUPPORTED_PUSH"></a>
1833+
### `ERR_QUICSTREAM_UNSUPPORTED_PUSH`
1834+
1835+
> Stability: 1 - Experimental
1836+
1837+
TBD
1838+
17201839
<a id="ERR_REQUIRE_ESM"></a>
17211840
### `ERR_REQUIRE_ESM`
17221841

doc/api/index.md

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
* [Process](process.html)
4545
* [Punycode](punycode.html)
4646
* [Query Strings](querystring.html)
47+
* [QUIC](quic.html)
4748
* [Readline](readline.html)
4849
* [REPL](repl.html)
4950
* [Report](report.html)

doc/api/net.md

+9
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,14 @@ immediately initiates connection with
11051105
[`socket.connect(port[, host][, connectListener])`][`socket.connect(port)`],
11061106
then returns the `net.Socket` that starts the connection.
11071107

1108+
## `net.createQuicSocket([options])`
1109+
<!-- YAML
1110+
added: REPLACEME
1111+
-->
1112+
1113+
Creates and returns a new `QuicSocket`. Please refer to the [QUIC documentation][]
1114+
for details.
1115+
11081116
## `net.createServer([options][, connectionListener])`
11091117
<!-- YAML
11101118
added: v0.5.0
@@ -1213,6 +1221,7 @@ Returns `true` if input is a version 6 IP address, otherwise returns `false`.
12131221
[IPC]: #net_ipc_support
12141222
[Identifying paths for IPC connections]: #net_identifying_paths_for_ipc_connections
12151223
[Readable Stream]: stream.html#stream_class_stream_readable
1224+
[QUIC documentation]: quic.html
12161225
[`'close'`]: #net_event_close
12171226
[`'connect'`]: #net_event_connect
12181227
[`'connection'`]: #net_event_connection

0 commit comments

Comments
 (0)