Skip to content

Commit

Permalink
quic: initial quic implementation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
9 people committed Mar 24, 2020
1 parent 2c308e3 commit 2c9f904
Show file tree
Hide file tree
Showing 125 changed files with 25,684 additions and 106 deletions.
52 changes: 52 additions & 0 deletions LICENSE
Expand Up @@ -1316,6 +1316,58 @@ The externally maintained libraries used by Node.js are:
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""

- ngtcp2, located at deps/ngtcp2, is licensed as follows:
"""
The MIT License

Copyright (c) 2016 ngtcp2 contributors

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""

- nghttp3, located at deps/nghttp3, is licensed as follows:
"""
The MIT License

Copyright (c) 2019 nghttp3 contributors

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""

- node-inspect, located at deps/node-inspect, is licensed as follows:
"""
Copyright Node.js contributors. All rights reserved.
Expand Down
57 changes: 57 additions & 0 deletions configure.py
Expand Up @@ -117,6 +117,11 @@
choices=valid_os,
help='operating system to build for ({0})'.format(', '.join(valid_os)))

parser.add_option('--experimental-quic',
action='store_true',
dest='experimental_quic',
help='enable experimental quic support')

parser.add_option('--gdb',
action='store_true',
dest='gdb',
Expand Down Expand Up @@ -259,6 +264,48 @@
dest='shared_nghttp2_libpath',
help='a directory to search for the shared nghttp2 DLLs')

shared_optgroup.add_option('--shared-ngtcp2',
action='store_true',
dest='shared_ngtcp2',
help='link to a shared ngtcp2 DLL instead of static linking')

shared_optgroup.add_option('--shared-ngtcp2-includes',
action='store',
dest='shared_ngtcp2_includes',
help='directory containing ngtcp2 header files')

shared_optgroup.add_option('--shared-ngtcp2-libname',
action='store',
dest='shared_ngtcp2_libname',
default='ngtcp2',
help='alternative lib name to link to [default: %default]')

shared_optgroup.add_option('--shared-ngtcp2-libpath',
action='store',
dest='shared_ngtcp2_libpath',
help='a directory to search for the shared ngtcp2 DLLs')

shared_optgroup.add_option('--shared-nghttp3',
action='store_true',
dest='shared_nghttp3',
help='link to a shared nghttp3 DLL instead of static linking')

shared_optgroup.add_option('--shared-nghttp3-includes',
action='store',
dest='shared_nghttp3_includes',
help='directory containing nghttp3 header files')

shared_optgroup.add_option('--shared-nghttp3-libname',
action='store',
dest='shared_nghttp3_libname',
default='nghttp3',
help='alternative lib name to link to [default: %default]')

shared_optgroup.add_option('--shared-nghttp3-libpath',
action='store',
dest='shared_nghttp3_libpath',
help='a directory to search for the shared nghttp3 DLLs')

shared_optgroup.add_option('--shared-openssl',
action='store_true',
dest='shared_openssl',
Expand Down Expand Up @@ -1145,6 +1192,14 @@ def configure_node(o):
else:
o['variables']['debug_nghttp2'] = 'false'

if options.experimental_quic:
if options.shared_openssl:
raise Exception('QUIC requires modified version of OpenSSL and cannot be'
' enabled with --shared-openssl.')
o['variables']['experimental_quic'] = 1
else:
o['variables']['experimental_quic'] = 'false'

o['variables']['node_no_browser_globals'] = b(options.no_browser_globals)

o['variables']['node_shared'] = b(options.shared)
Expand Down Expand Up @@ -1272,6 +1327,8 @@ def without_ssl_error(option):
without_ssl_error('--openssl-no-asm')
if options.openssl_fips:
without_ssl_error('--openssl-fips')
if options.experimental_quic:
without_ssl_error('--experimental-quic')
return

if options.use_openssl_ca_store:
Expand Down
7 changes: 7 additions & 0 deletions deps/openssl/openssl.gyp
Expand Up @@ -16,6 +16,13 @@
'OPENSSL_NO_HW',
],
'conditions': [
[
# Disable building QUIC support in openssl if experimental_quic
# is not enabled.
'experimental_quic!=1', {
'defines': ['OPENSSL_NO_QUIC=1'],
}
],
[ 'openssl_no_asm==1', {
'includes': ['./openssl_no_asm.gypi'],
}, 'target_arch=="arm64" and OS=="win"', {
Expand Down
126 changes: 126 additions & 0 deletions doc/api/errors.md
Expand Up @@ -1682,6 +1682,132 @@ Accessing `Object.prototype.__proto__` has been forbidden using
[`Object.setPrototypeOf`][] should be used to get and set the prototype of an
object.

<a id="ERR_QUIC_CANNOT_SET_GROUPS"></a>
### `ERR_QUIC_CANNOT_SET_GROUPS`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUIC_ERROR"></a>
### `ERR_QUIC_ERROR`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUIC_TLS13_REQUIRED"></a>
### `ERR_QUIC_TLS13_REQUIRED`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUIC_UNAVAILABLE"></a>
### `ERR_QUIC_UNAVAILABLE`

> Stabililty: 1 - Experimental
TBD

<a id="ERR_QUICCLIENTSESSION_FAILED"></a>
### `ERR_QUICCLIENTSESSION_FAILED`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICCLIENTSESSION_FAILED_SETSOCKET"></a>
### `ERR_QUICCLIENTSESSION_FAILED_SETSOCKET`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSESSION_DESTROYED"></a>
### `ERR_QUICSESSION_DESTROYED`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSESSION_INVALID_DCID"></a>
### `ERR_QUICSESSION_INVALID_DCID`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSESSION_UPDATEKEY"></a>
### `ERR_QUICSESSION_UPDATEKEY`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSESSION_VERSION_NEGOTIATION"></a>
### `ERR_QUICSESSION_VERSION_NEGOTIATION`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSOCKET_DESTROYED"></a>
### `ERR_QUICSOCKET_DESTROYED`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSOCKET_INVALID_STATELESS_RESET_SECRET_LENGTH"></a>
### `ERR_QUICSOCKET_INVALID_STATELESS_RESET_SECRET_LENGTH`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSOCKET_LISTENING"></a>
### `ERR_QUICSOCKET_LISTENING`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSOCKET_UNBOUND"></a>
### `ERR_QUICSOCKET_UNBOUND`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSTREAM_DESTROYED"></a>
### `ERR_QUICSTREAM_DESTROYED`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSTREAM_INVALID_PUSH"></a>
### `ERR_QUICSTREAM_INVALID_PUSH`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSTREAM_OPEN_FAILED"></a>
### `ERR_QUICSTREAM_OPEN_FAILED`

> Stability: 1 - Experimental
TBD

<a id="ERR_QUICSTREAM_UNSUPPORTED_PUSH"></a>
### `ERR_QUICSTREAM_UNSUPPORTED_PUSH`

> Stability: 1 - Experimental
TBD

<a id="ERR_REQUIRE_ESM"></a>
### `ERR_REQUIRE_ESM`

Expand Down
1 change: 1 addition & 0 deletions doc/api/index.md
Expand Up @@ -44,6 +44,7 @@
* [Process](process.html)
* [Punycode](punycode.html)
* [Query Strings](querystring.html)
* [QUIC](quic.html)
* [Readline](readline.html)
* [REPL](repl.html)
* [Report](report.html)
Expand Down
9 changes: 9 additions & 0 deletions doc/api/net.md
Expand Up @@ -1115,6 +1115,14 @@ immediately initiates connection with
[`socket.connect(port[, host][, connectListener])`][`socket.connect(port, host)`],
then returns the `net.Socket` that starts the connection.

## `net.createQuicSocket([options])`
<!-- YAML
added: REPLACEME
-->

Creates and returns a new `QuicSocket`. Please refer to the [QUIC documentation][]
for details.

## `net.createServer([options][, connectionListener])`
<!-- YAML
added: v0.5.0
Expand Down Expand Up @@ -1224,6 +1232,7 @@ Returns `true` if input is a version 6 IP address, otherwise returns `false`.
[IPC]: #net_ipc_support
[Identifying paths for IPC connections]: #net_identifying_paths_for_ipc_connections
[Readable Stream]: stream.html#stream_class_stream_readable
[QUIC documentation]: quic.html
[`'close'`]: #net_event_close
[`'connect'`]: #net_event_connect
[`'connection'`]: #net_event_connection
Expand Down

0 comments on commit 2c9f904

Please sign in to comment.