protocol-quic 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data/ext/ngtcp2/AUTHORS +44 -0
- data/ext/ngtcp2/CMakeLists.txt +431 -0
- data/ext/ngtcp2/CMakeOptions.txt +17 -0
- data/ext/ngtcp2/COPYING +22 -0
- data/ext/ngtcp2/ChangeLog +0 -0
- data/ext/ngtcp2/Makefile.am +60 -0
- data/ext/ngtcp2/NEWS +0 -0
- data/ext/ngtcp2/README +1 -0
- data/ext/ngtcp2/README.rst +258 -0
- data/ext/ngtcp2/ci/build_boringssl.sh +10 -0
- data/ext/ngtcp2/ci/build_nghttp3.sh +9 -0
- data/ext/ngtcp2/ci/build_openssl1.sh +8 -0
- data/ext/ngtcp2/ci/build_openssl1_cross.sh +9 -0
- data/ext/ngtcp2/ci/build_openssl3.sh +8 -0
- data/ext/ngtcp2/ci/build_picotls.sh +26 -0
- data/ext/ngtcp2/ci/build_wolfssl.sh +9 -0
- data/ext/ngtcp2/ci/gen-certificate.sh +8 -0
- data/ext/ngtcp2/cmake/ExtractValidFlags.cmake +31 -0
- data/ext/ngtcp2/cmake/FindCUnit.cmake +40 -0
- data/ext/ngtcp2/cmake/FindJemalloc.cmake +40 -0
- data/ext/ngtcp2/cmake/FindLibev.cmake +38 -0
- data/ext/ngtcp2/cmake/FindLibnghttp3.cmake +41 -0
- data/ext/ngtcp2/cmake/Findwolfssl.cmake +41 -0
- data/ext/ngtcp2/cmake/Version.cmake +11 -0
- data/ext/ngtcp2/cmakeconfig.h.in +36 -0
- data/ext/ngtcp2/configure.ac +755 -0
- data/ext/ngtcp2/crypto/CMakeLists.txt +56 -0
- data/ext/ngtcp2/crypto/Makefile.am +49 -0
- data/ext/ngtcp2/crypto/boringssl/CMakeLists.txt +64 -0
- data/ext/ngtcp2/crypto/boringssl/Makefile.am +39 -0
- data/ext/ngtcp2/crypto/boringssl/boringssl.c +630 -0
- data/ext/ngtcp2/crypto/boringssl/libngtcp2_crypto_boringssl.pc.in +33 -0
- data/ext/ngtcp2/crypto/gnutls/CMakeLists.txt +86 -0
- data/ext/ngtcp2/crypto/gnutls/Makefile.am +43 -0
- data/ext/ngtcp2/crypto/gnutls/gnutls.c +644 -0
- data/ext/ngtcp2/crypto/gnutls/libngtcp2_crypto_gnutls.pc.in +33 -0
- data/ext/ngtcp2/crypto/includes/CMakeLists.txt +56 -0
- data/ext/ngtcp2/crypto/includes/Makefile.am +45 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto.h +893 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_boringssl.h +104 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_gnutls.h +107 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_openssl.h +132 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_picotls.h +246 -0
- data/ext/ngtcp2/crypto/includes/ngtcp2/ngtcp2_crypto_wolfssl.h +106 -0
- data/ext/ngtcp2/crypto/openssl/CMakeLists.txt +86 -0
- data/ext/ngtcp2/crypto/openssl/Makefile.am +43 -0
- data/ext/ngtcp2/crypto/openssl/libngtcp2_crypto_openssl.pc.in +33 -0
- data/ext/ngtcp2/crypto/openssl/openssl.c +807 -0
- data/ext/ngtcp2/crypto/picotls/CMakeLists.txt +65 -0
- data/ext/ngtcp2/crypto/picotls/Makefile.am +39 -0
- data/ext/ngtcp2/crypto/picotls/libngtcp2_crypto_picotls.pc.in +33 -0
- data/ext/ngtcp2/crypto/picotls/picotls.c +707 -0
- data/ext/ngtcp2/crypto/shared.c +1431 -0
- data/ext/ngtcp2/crypto/shared.h +350 -0
- data/ext/ngtcp2/crypto/wolfssl/CMakeLists.txt +84 -0
- data/ext/ngtcp2/crypto/wolfssl/Makefile.am +43 -0
- data/ext/ngtcp2/crypto/wolfssl/libngtcp2_crypto_wolfssl.pc.in +33 -0
- data/ext/ngtcp2/crypto/wolfssl/wolfssl.c +534 -0
- data/ext/ngtcp2/doc/Makefile.am +65 -0
- data/ext/ngtcp2/doc/make.bat +35 -0
- data/ext/ngtcp2/doc/mkapiref.py +356 -0
- data/ext/ngtcp2/doc/source/conf.py.in +94 -0
- data/ext/ngtcp2/doc/source/index.rst +22 -0
- data/ext/ngtcp2/doc/source/programmers-guide.rst +476 -0
- data/ext/ngtcp2/docker/Dockerfile +39 -0
- data/ext/ngtcp2/examples/CMakeLists.txt +361 -0
- data/ext/ngtcp2/examples/Makefile.am +228 -0
- data/ext/ngtcp2/examples/client.cc +3049 -0
- data/ext/ngtcp2/examples/client.h +192 -0
- data/ext/ngtcp2/examples/client_base.cc +202 -0
- data/ext/ngtcp2/examples/client_base.h +213 -0
- data/ext/ngtcp2/examples/debug.cc +298 -0
- data/ext/ngtcp2/examples/debug.h +124 -0
- data/ext/ngtcp2/examples/examplestest.cc +84 -0
- data/ext/ngtcp2/examples/gtlssimpleclient.c +720 -0
- data/ext/ngtcp2/examples/h09client.cc +2601 -0
- data/ext/ngtcp2/examples/h09client.h +196 -0
- data/ext/ngtcp2/examples/h09server.cc +3024 -0
- data/ext/ngtcp2/examples/h09server.h +237 -0
- data/ext/ngtcp2/examples/http.cc +138 -0
- data/ext/ngtcp2/examples/http.h +44 -0
- data/ext/ngtcp2/examples/network.h +80 -0
- data/ext/ngtcp2/examples/server.cc +3731 -0
- data/ext/ngtcp2/examples/server.h +256 -0
- data/ext/ngtcp2/examples/server_base.cc +58 -0
- data/ext/ngtcp2/examples/server_base.h +195 -0
- data/ext/ngtcp2/examples/shared.cc +385 -0
- data/ext/ngtcp2/examples/shared.h +96 -0
- data/ext/ngtcp2/examples/simpleclient.c +683 -0
- data/ext/ngtcp2/examples/template.h +71 -0
- data/ext/ngtcp2/examples/tests/README.rst +60 -0
- data/ext/ngtcp2/examples/tests/__init__.py +0 -0
- data/ext/ngtcp2/examples/tests/config.ini.in +32 -0
- data/ext/ngtcp2/examples/tests/conftest.py +28 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/__init__.py +6 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/certs.py +476 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/client.py +187 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/env.py +191 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/log.py +101 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/server.py +137 -0
- data/ext/ngtcp2/examples/tests/ngtcp2test/tls.py +983 -0
- data/ext/ngtcp2/examples/tests/test_01_handshake.py +30 -0
- data/ext/ngtcp2/examples/tests/test_02_resume.py +46 -0
- data/ext/ngtcp2/examples/tests/test_03_earlydata.py +56 -0
- data/ext/ngtcp2/examples/tests/test_04_clientcert.py +57 -0
- data/ext/ngtcp2/examples/tests/test_05_ciphers.py +46 -0
- data/ext/ngtcp2/examples/tls_client_context.h +52 -0
- data/ext/ngtcp2/examples/tls_client_context_boringssl.cc +126 -0
- data/ext/ngtcp2/examples/tls_client_context_boringssl.h +49 -0
- data/ext/ngtcp2/examples/tls_client_context_gnutls.cc +74 -0
- data/ext/ngtcp2/examples/tls_client_context_gnutls.h +50 -0
- data/ext/ngtcp2/examples/tls_client_context_openssl.cc +137 -0
- data/ext/ngtcp2/examples/tls_client_context_openssl.h +49 -0
- data/ext/ngtcp2/examples/tls_client_context_picotls.cc +158 -0
- data/ext/ngtcp2/examples/tls_client_context_picotls.h +53 -0
- data/ext/ngtcp2/examples/tls_client_context_wolfssl.cc +177 -0
- data/ext/ngtcp2/examples/tls_client_context_wolfssl.h +51 -0
- data/ext/ngtcp2/examples/tls_client_session.h +52 -0
- data/ext/ngtcp2/examples/tls_client_session_boringssl.cc +110 -0
- data/ext/ngtcp2/examples/tls_client_session_boringssl.h +52 -0
- data/ext/ngtcp2/examples/tls_client_session_gnutls.cc +190 -0
- data/ext/ngtcp2/examples/tls_client_session_gnutls.h +52 -0
- data/ext/ngtcp2/examples/tls_client_session_openssl.cc +113 -0
- data/ext/ngtcp2/examples/tls_client_session_openssl.h +52 -0
- data/ext/ngtcp2/examples/tls_client_session_picotls.cc +147 -0
- data/ext/ngtcp2/examples/tls_client_session_picotls.h +52 -0
- data/ext/ngtcp2/examples/tls_client_session_wolfssl.cc +160 -0
- data/ext/ngtcp2/examples/tls_client_session_wolfssl.h +52 -0
- data/ext/ngtcp2/examples/tls_server_context.h +52 -0
- data/ext/ngtcp2/examples/tls_server_context_boringssl.cc +257 -0
- data/ext/ngtcp2/examples/tls_server_context_boringssl.h +54 -0
- data/ext/ngtcp2/examples/tls_server_context_gnutls.cc +99 -0
- data/ext/ngtcp2/examples/tls_server_context_gnutls.h +59 -0
- data/ext/ngtcp2/examples/tls_server_context_openssl.cc +338 -0
- data/ext/ngtcp2/examples/tls_server_context_openssl.h +54 -0
- data/ext/ngtcp2/examples/tls_server_context_picotls.cc +321 -0
- data/ext/ngtcp2/examples/tls_server_context_picotls.h +58 -0
- data/ext/ngtcp2/examples/tls_server_context_wolfssl.cc +284 -0
- data/ext/ngtcp2/examples/tls_server_context_wolfssl.h +55 -0
- data/ext/ngtcp2/examples/tls_server_session.h +52 -0
- data/ext/ngtcp2/examples/tls_server_session_boringssl.cc +84 -0
- data/ext/ngtcp2/examples/tls_server_session_boringssl.h +47 -0
- data/ext/ngtcp2/examples/tls_server_session_gnutls.cc +155 -0
- data/ext/ngtcp2/examples/tls_server_session_gnutls.h +46 -0
- data/ext/ngtcp2/examples/tls_server_session_openssl.cc +54 -0
- data/ext/ngtcp2/examples/tls_server_session_openssl.h +47 -0
- data/ext/ngtcp2/examples/tls_server_session_picotls.cc +70 -0
- data/ext/ngtcp2/examples/tls_server_session_picotls.h +47 -0
- data/ext/ngtcp2/examples/tls_server_session_wolfssl.cc +55 -0
- data/ext/ngtcp2/examples/tls_server_session_wolfssl.h +47 -0
- data/ext/ngtcp2/examples/tls_session_base_gnutls.cc +87 -0
- data/ext/ngtcp2/examples/tls_session_base_gnutls.h +51 -0
- data/ext/ngtcp2/examples/tls_session_base_openssl.cc +54 -0
- data/ext/ngtcp2/examples/tls_session_base_openssl.h +52 -0
- data/ext/ngtcp2/examples/tls_session_base_picotls.cc +56 -0
- data/ext/ngtcp2/examples/tls_session_base_picotls.h +54 -0
- data/ext/ngtcp2/examples/tls_session_base_wolfssl.cc +54 -0
- data/ext/ngtcp2/examples/tls_session_base_wolfssl.h +54 -0
- data/ext/ngtcp2/examples/tls_shared_picotls.cc +59 -0
- data/ext/ngtcp2/examples/tls_shared_picotls.h +36 -0
- data/ext/ngtcp2/examples/util.cc +646 -0
- data/ext/ngtcp2/examples/util.h +361 -0
- data/ext/ngtcp2/examples/util_gnutls.cc +136 -0
- data/ext/ngtcp2/examples/util_openssl.cc +131 -0
- data/ext/ngtcp2/examples/util_test.cc +237 -0
- data/ext/ngtcp2/examples/util_test.h +45 -0
- data/ext/ngtcp2/examples/util_wolfssl.cc +130 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/ack +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/ack_ecn +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/connection_close +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/crypto +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/data_blocked +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/datagram +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/datagram_len +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/max_data +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/max_stream_data +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/max_streams +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/new_connection_id +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/new_token +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/path_challenge +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/path_response +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/reset_stream +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/retire_connection_id +1 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stop_sending +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stream +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stream_data_blocked +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/stream_len +0 -0
- data/ext/ngtcp2/fuzz/corpus/decode_frame/streams_blocked +0 -0
- data/ext/ngtcp2/fuzz/corpus/ksl/random +0 -0
- data/ext/ngtcp2/fuzz/decode_frame.cc +25 -0
- data/ext/ngtcp2/fuzz/ksl.cc +77 -0
- data/ext/ngtcp2/interop/Dockerfile +39 -0
- data/ext/ngtcp2/interop/run_endpoint.sh +93 -0
- data/ext/ngtcp2/lib/CMakeLists.txt +110 -0
- data/ext/ngtcp2/lib/Makefile.am +122 -0
- data/ext/ngtcp2/lib/includes/CMakeLists.txt +4 -0
- data/ext/ngtcp2/lib/includes/Makefile.am +25 -0
- data/ext/ngtcp2/lib/includes/ngtcp2/ngtcp2.h +5843 -0
- data/ext/ngtcp2/lib/includes/ngtcp2/version.h.in +51 -0
- data/ext/ngtcp2/lib/libngtcp2.pc.in +33 -0
- data/ext/ngtcp2/lib/ngtcp2_acktr.c +335 -0
- data/ext/ngtcp2/lib/ngtcp2_acktr.h +221 -0
- data/ext/ngtcp2/lib/ngtcp2_addr.c +117 -0
- data/ext/ngtcp2/lib/ngtcp2_addr.h +69 -0
- data/ext/ngtcp2/lib/ngtcp2_balloc.c +90 -0
- data/ext/ngtcp2/lib/ngtcp2_balloc.h +91 -0
- data/ext/ngtcp2/lib/ngtcp2_bbr.c +693 -0
- data/ext/ngtcp2/lib/ngtcp2_bbr.h +157 -0
- data/ext/ngtcp2/lib/ngtcp2_bbr2.c +1490 -0
- data/ext/ngtcp2/lib/ngtcp2_bbr2.h +149 -0
- data/ext/ngtcp2/lib/ngtcp2_buf.c +56 -0
- data/ext/ngtcp2/lib/ngtcp2_buf.h +108 -0
- data/ext/ngtcp2/lib/ngtcp2_cc.c +616 -0
- data/ext/ngtcp2/lib/ngtcp2_cc.h +422 -0
- data/ext/ngtcp2/lib/ngtcp2_cid.c +147 -0
- data/ext/ngtcp2/lib/ngtcp2_cid.h +175 -0
- data/ext/ngtcp2/lib/ngtcp2_conn.c +13731 -0
- data/ext/ngtcp2/lib/ngtcp2_conn.h +1119 -0
- data/ext/ngtcp2/lib/ngtcp2_conn_stat.h +131 -0
- data/ext/ngtcp2/lib/ngtcp2_conv.c +291 -0
- data/ext/ngtcp2/lib/ngtcp2_conv.h +208 -0
- data/ext/ngtcp2/lib/ngtcp2_crypto.c +895 -0
- data/ext/ngtcp2/lib/ngtcp2_crypto.h +148 -0
- data/ext/ngtcp2/lib/ngtcp2_err.c +154 -0
- data/ext/ngtcp2/lib/ngtcp2_err.h +34 -0
- data/ext/ngtcp2/lib/ngtcp2_gaptr.c +167 -0
- data/ext/ngtcp2/lib/ngtcp2_gaptr.h +98 -0
- data/ext/ngtcp2/lib/ngtcp2_idtr.c +79 -0
- data/ext/ngtcp2/lib/ngtcp2_idtr.h +89 -0
- data/ext/ngtcp2/lib/ngtcp2_ksl.c +819 -0
- data/ext/ngtcp2/lib/ngtcp2_ksl.h +345 -0
- data/ext/ngtcp2/lib/ngtcp2_log.c +822 -0
- data/ext/ngtcp2/lib/ngtcp2_log.h +123 -0
- data/ext/ngtcp2/lib/ngtcp2_macro.h +58 -0
- data/ext/ngtcp2/lib/ngtcp2_map.c +336 -0
- data/ext/ngtcp2/lib/ngtcp2_map.h +136 -0
- data/ext/ngtcp2/lib/ngtcp2_mem.c +113 -0
- data/ext/ngtcp2/lib/ngtcp2_mem.h +72 -0
- data/ext/ngtcp2/lib/ngtcp2_net.h +136 -0
- data/ext/ngtcp2/lib/ngtcp2_objalloc.c +40 -0
- data/ext/ngtcp2/lib/ngtcp2_objalloc.h +140 -0
- data/ext/ngtcp2/lib/ngtcp2_opl.c +46 -0
- data/ext/ngtcp2/lib/ngtcp2_opl.h +65 -0
- data/ext/ngtcp2/lib/ngtcp2_path.c +77 -0
- data/ext/ngtcp2/lib/ngtcp2_path.h +49 -0
- data/ext/ngtcp2/lib/ngtcp2_pkt.c +2527 -0
- data/ext/ngtcp2/lib/ngtcp2_pkt.h +1235 -0
- data/ext/ngtcp2/lib/ngtcp2_pmtud.c +160 -0
- data/ext/ngtcp2/lib/ngtcp2_pmtud.h +123 -0
- data/ext/ngtcp2/lib/ngtcp2_ppe.c +230 -0
- data/ext/ngtcp2/lib/ngtcp2_ppe.h +153 -0
- data/ext/ngtcp2/lib/ngtcp2_pq.c +164 -0
- data/ext/ngtcp2/lib/ngtcp2_pq.h +126 -0
- data/ext/ngtcp2/lib/ngtcp2_pv.c +172 -0
- data/ext/ngtcp2/lib/ngtcp2_pv.h +194 -0
- data/ext/ngtcp2/lib/ngtcp2_qlog.c +1219 -0
- data/ext/ngtcp2/lib/ngtcp2_qlog.h +161 -0
- data/ext/ngtcp2/lib/ngtcp2_range.c +61 -0
- data/ext/ngtcp2/lib/ngtcp2_range.h +80 -0
- data/ext/ngtcp2/lib/ngtcp2_rcvry.h +40 -0
- data/ext/ngtcp2/lib/ngtcp2_ringbuf.c +121 -0
- data/ext/ngtcp2/lib/ngtcp2_ringbuf.h +132 -0
- data/ext/ngtcp2/lib/ngtcp2_rob.c +319 -0
- data/ext/ngtcp2/lib/ngtcp2_rob.h +197 -0
- data/ext/ngtcp2/lib/ngtcp2_rst.c +138 -0
- data/ext/ngtcp2/lib/ngtcp2_rst.h +86 -0
- data/ext/ngtcp2/lib/ngtcp2_rtb.c +1676 -0
- data/ext/ngtcp2/lib/ngtcp2_rtb.h +468 -0
- data/ext/ngtcp2/lib/ngtcp2_str.c +233 -0
- data/ext/ngtcp2/lib/ngtcp2_str.h +94 -0
- data/ext/ngtcp2/lib/ngtcp2_strm.c +698 -0
- data/ext/ngtcp2/lib/ngtcp2_strm.h +310 -0
- data/ext/ngtcp2/lib/ngtcp2_unreachable.c +71 -0
- data/ext/ngtcp2/lib/ngtcp2_unreachable.h +46 -0
- data/ext/ngtcp2/lib/ngtcp2_vec.c +243 -0
- data/ext/ngtcp2/lib/ngtcp2_vec.h +120 -0
- data/ext/ngtcp2/lib/ngtcp2_version.c +39 -0
- data/ext/ngtcp2/lib/ngtcp2_window_filter.c +99 -0
- data/ext/ngtcp2/lib/ngtcp2_window_filter.h +65 -0
- data/ext/ngtcp2/m4/ax_check_compile_flag.m4 +74 -0
- data/ext/ngtcp2/m4/ax_cxx_compile_stdcxx.m4 +1009 -0
- data/ext/ngtcp2/tests/CMakeLists.txt +68 -0
- data/ext/ngtcp2/tests/Makefile.am +94 -0
- data/ext/ngtcp2/tests/main.c +358 -0
- data/ext/ngtcp2/tests/ngtcp2_acktr_test.c +367 -0
- data/ext/ngtcp2/tests/ngtcp2_acktr_test.h +37 -0
- data/ext/ngtcp2/tests/ngtcp2_conn_test.c +9821 -0
- data/ext/ngtcp2/tests/ngtcp2_conn_test.h +104 -0
- data/ext/ngtcp2/tests/ngtcp2_conv_test.c +430 -0
- data/ext/ngtcp2/tests/ngtcp2_conv_test.h +46 -0
- data/ext/ngtcp2/tests/ngtcp2_crypto_test.c +667 -0
- data/ext/ngtcp2/tests/ngtcp2_crypto_test.h +35 -0
- data/ext/ngtcp2/tests/ngtcp2_gaptr_test.c +127 -0
- data/ext/ngtcp2/tests/ngtcp2_gaptr_test.h +36 -0
- data/ext/ngtcp2/tests/ngtcp2_idtr_test.c +79 -0
- data/ext/ngtcp2/tests/ngtcp2_idtr_test.h +34 -0
- data/ext/ngtcp2/tests/ngtcp2_ksl_test.c +502 -0
- data/ext/ngtcp2/tests/ngtcp2_ksl_test.h +39 -0
- data/ext/ngtcp2/tests/ngtcp2_map_test.c +206 -0
- data/ext/ngtcp2/tests/ngtcp2_map_test.h +38 -0
- data/ext/ngtcp2/tests/ngtcp2_pkt_test.c +1645 -0
- data/ext/ngtcp2/tests/ngtcp2_pkt_test.h +68 -0
- data/ext/ngtcp2/tests/ngtcp2_pmtud_test.c +153 -0
- data/ext/ngtcp2/tests/ngtcp2_pmtud_test.h +34 -0
- data/ext/ngtcp2/tests/ngtcp2_pv_test.c +129 -0
- data/ext/ngtcp2/tests/ngtcp2_pv_test.h +35 -0
- data/ext/ngtcp2/tests/ngtcp2_range_test.c +105 -0
- data/ext/ngtcp2/tests/ngtcp2_range_test.h +36 -0
- data/ext/ngtcp2/tests/ngtcp2_ringbuf_test.c +91 -0
- data/ext/ngtcp2/tests/ngtcp2_ringbuf_test.h +35 -0
- data/ext/ngtcp2/tests/ngtcp2_rob_test.c +552 -0
- data/ext/ngtcp2/tests/ngtcp2_rob_test.h +37 -0
- data/ext/ngtcp2/tests/ngtcp2_rtb_test.c +470 -0
- data/ext/ngtcp2/tests/ngtcp2_rtb_test.h +38 -0
- data/ext/ngtcp2/tests/ngtcp2_str_test.c +96 -0
- data/ext/ngtcp2/tests/ngtcp2_str_test.h +36 -0
- data/ext/ngtcp2/tests/ngtcp2_strm_test.c +575 -0
- data/ext/ngtcp2/tests/ngtcp2_strm_test.h +36 -0
- data/ext/ngtcp2/tests/ngtcp2_test_helper.c +404 -0
- data/ext/ngtcp2/tests/ngtcp2_test_helper.h +191 -0
- data/ext/ngtcp2/tests/ngtcp2_vec_test.c +426 -0
- data/ext/ngtcp2/tests/ngtcp2_vec_test.h +36 -0
- data/ext/ngtcp2/third-party/CMakeLists.txt +34 -0
- data/ext/ngtcp2/third-party/Makefile.am +31 -0
- data/ext/ngtcp2/third-party/http-parser/AUTHORS +68 -0
- data/ext/ngtcp2/third-party/http-parser/LICENSE-MIT +23 -0
- data/ext/ngtcp2/third-party/http-parser/Makefile +157 -0
- data/ext/ngtcp2/third-party/http-parser/README.md +246 -0
- data/ext/ngtcp2/third-party/http-parser/bench.c +111 -0
- data/ext/ngtcp2/third-party/http-parser/contrib/parsertrace.c +160 -0
- data/ext/ngtcp2/third-party/http-parser/contrib/url_parser.c +47 -0
- data/ext/ngtcp2/third-party/http-parser/http_parser.c +2419 -0
- data/ext/ngtcp2/third-party/http-parser/http_parser.gyp +111 -0
- data/ext/ngtcp2/third-party/http-parser/http_parser.h +431 -0
- data/ext/ngtcp2/third-party/http-parser/test.c +4411 -0
- data/lib/protocol/quic/version.rb +10 -0
- data/lib/protocol/quic.rb +9 -0
- data/license.md +21 -0
- data.tar.gz.sig +1 -0
- metadata +424 -0
- metadata.gz.sig +1 -0
@@ -0,0 +1,476 @@
|
|
1
|
+
The ngtcp2 programmers' guide for early adopters
|
2
|
+
================================================
|
3
|
+
|
4
|
+
This document is written for early adopters of ngtcp2 library. It
|
5
|
+
describes a brief introduction of programming ngtcp2.
|
6
|
+
|
7
|
+
Prerequisites
|
8
|
+
-------------
|
9
|
+
|
10
|
+
Reading :rfc:`9000` and :rfc:`9001` helps you a lot to write QUIC
|
11
|
+
application. They describes how TLS is integrated into QUIC and why
|
12
|
+
the existing TLS stack cannot be used with QUIC.
|
13
|
+
|
14
|
+
QUIC requires the special interface from TLS stack, which is probably
|
15
|
+
not available from most of the existing TLS stacks. As far as I know,
|
16
|
+
the TLS stacks maintained by the active participants of QUIC working
|
17
|
+
group only get this interface at the time of this writing. In order
|
18
|
+
to build QUIC application you have to choose one of them. Here is the
|
19
|
+
list of TLS stacks which are supposed to provide such interface and
|
20
|
+
for which we provide crypto helper libraries:
|
21
|
+
|
22
|
+
* `OpenSSL with QUIC support <https://github.com/quictls/openssl>`_
|
23
|
+
* GnuTLS
|
24
|
+
* BoringSSL
|
25
|
+
* Picotls
|
26
|
+
* wolfSSL
|
27
|
+
|
28
|
+
Creating ngtcp2_conn object
|
29
|
+
---------------------------
|
30
|
+
|
31
|
+
:type:`ngtcp2_conn` is the primary object to present a single QUIC
|
32
|
+
connection. Use `ngtcp2_conn_client_new()` for client application,
|
33
|
+
and `ngtcp2_conn_server_new()` for server.
|
34
|
+
|
35
|
+
They require :type:`ngtcp2_callbacks`, :type:`ngtcp2_settings`, and
|
36
|
+
:type:`ngtcp2_transport_params` objects.
|
37
|
+
|
38
|
+
The :type:`ngtcp2_callbacks` contains the callback functions which
|
39
|
+
:type:`ngtcp2_conn` calls when a specific event happens, say,
|
40
|
+
receiving stream data or stream is closed, etc. Some of the callback
|
41
|
+
functions are optional. For client application, the following
|
42
|
+
callback functions must be set:
|
43
|
+
|
44
|
+
* :member:`client_initial <ngtcp2_callbacks.client_initial>`:
|
45
|
+
`ngtcp2_crypto_client_initial_cb()` can be passed directly.
|
46
|
+
* :member:`recv_crypto_data <ngtcp2_callbacks.recv_crypto_data>`:
|
47
|
+
`ngtcp2_crypto_recv_crypto_data_cb()` can be passed directly.
|
48
|
+
* :member:`encrypt <ngtcp2_callbacks.encrypt>`:
|
49
|
+
`ngtcp2_crypto_encrypt_cb()` can be passed directly.
|
50
|
+
* :member:`decrypt <ngtcp2_callbacks.decrypt>`:
|
51
|
+
`ngtcp2_crypto_decrypt_cb()` can be passed directly.
|
52
|
+
* :member:`hp_mask <ngtcp2_callbacks.hp_mask>`:
|
53
|
+
`ngtcp2_crypto_hp_mask_cb()` can be passed directly.
|
54
|
+
* :member:`recv_retry <ngtcp2_callbacks.recv_retry>`:
|
55
|
+
`ngtcp2_crypto_recv_retry_cb()` can be passed directly.
|
56
|
+
* :member:`rand <ngtcp2_callbacks.rand>`
|
57
|
+
* :member:`get_new_connection_id
|
58
|
+
<ngtcp2_callbacks.get_new_connection_id>`
|
59
|
+
* :member:`update_key <ngtcp2_callbacks.update_key>`:
|
60
|
+
`ngtcp2_crypto_update_key_cb()` can be passed directly.
|
61
|
+
* :member:`delete_crypto_aead_ctx
|
62
|
+
<ngtcp2_callbacks.delete_crypto_aead_ctx>`:
|
63
|
+
`ngtcp2_crypto_delete_crypto_aead_ctx_cb()` can be passed directly.
|
64
|
+
* :member:`delete_crypto_cipher_ctx
|
65
|
+
<ngtcp2_callbacks.delete_crypto_cipher_ctx>`:
|
66
|
+
`ngtcp2_crypto_delete_crypto_cipher_ctx_cb()` can be passed
|
67
|
+
directly.
|
68
|
+
* :member:`get_path_challenge_data
|
69
|
+
<ngtcp2_callbacks.get_path_challenge_data>`:
|
70
|
+
`ngtcp2_crypto_get_path_challenge_data_cb()` can be passed directly.
|
71
|
+
* :member:`version_negotiation
|
72
|
+
<ngtcp2_callbacks.version_negotiation>`:
|
73
|
+
`ngtcp2_crypto_version_negotiation_cb()` can be passed directly.
|
74
|
+
|
75
|
+
For server application, the following callback functions must be set:
|
76
|
+
|
77
|
+
* :member:`recv_client_initial
|
78
|
+
<ngtcp2_callbacks.recv_client_initial>`:
|
79
|
+
`ngtcp2_crypto_recv_client_initial_cb()` can be passed directly.
|
80
|
+
* :member:`recv_crypto_data <ngtcp2_callbacks.recv_crypto_data>`:
|
81
|
+
`ngtcp2_crypto_recv_crypto_data_cb()` can be passed directly.
|
82
|
+
* :member:`encrypt <ngtcp2_callbacks.encrypt>`:
|
83
|
+
`ngtcp2_crypto_encrypt_cb()` can be passed directly.
|
84
|
+
* :member:`decrypt <ngtcp2_callbacks.decrypt>`:
|
85
|
+
`ngtcp2_crypto_decrypt_cb()` can be passed directly.
|
86
|
+
* :member:`hp_mask <ngtcp2_callbacks.hp_mask>`:
|
87
|
+
`ngtcp2_crypto_hp_mask_cb()` can be passed directly.
|
88
|
+
* :member:`rand <ngtcp2_callbacks.rand>`
|
89
|
+
* :member:`get_new_connection_id
|
90
|
+
<ngtcp2_callbacks.get_new_connection_id>`
|
91
|
+
* :member:`update_key <ngtcp2_callbacks.update_key>`:
|
92
|
+
`ngtcp2_crypto_update_key_cb()` can be passed directly.
|
93
|
+
* :member:`delete_crypto_aead_ctx
|
94
|
+
<ngtcp2_callbacks.delete_crypto_aead_ctx>`:
|
95
|
+
`ngtcp2_crypto_delete_crypto_aead_ctx_cb()` can be passed directly.
|
96
|
+
* :member:`delete_crypto_cipher_ctx
|
97
|
+
<ngtcp2_callbacks.delete_crypto_cipher_ctx>`:
|
98
|
+
`ngtcp2_crypto_delete_crypto_cipher_ctx_cb()` can be passed
|
99
|
+
directly.
|
100
|
+
* :member:`get_path_challenge_data
|
101
|
+
<ngtcp2_callbacks.get_path_challenge_data>`:
|
102
|
+
`ngtcp2_crypto_get_path_challenge_data_cb()` can be passed directly.
|
103
|
+
* :member:`version_negotiation
|
104
|
+
<ngtcp2_callbacks.version_negotiation>`:
|
105
|
+
`ngtcp2_crypto_version_negotiation_cb()` can be passed directly.
|
106
|
+
|
107
|
+
``ngtcp2_crypto_*`` functions are a part of :doc:`ngtcp2 crypto API
|
108
|
+
<crypto_apiref>` which provides easy integration with the supported
|
109
|
+
TLS backend. It vastly simplifies TLS integration and is strongly
|
110
|
+
recommended.
|
111
|
+
|
112
|
+
:type:`ngtcp2_settings` contains the settings for QUIC connection.
|
113
|
+
All fields must be set. Application should call
|
114
|
+
`ngtcp2_settings_default()` to set the default values. It would be
|
115
|
+
very useful to enable debug logging by setting logging function to
|
116
|
+
:member:`ngtcp2_settings.log_printf` field. ngtcp2 library relies on
|
117
|
+
the timestamp fed from application. The initial timestamp must be
|
118
|
+
passed to :member:`ngtcp2_settings.initial_ts` field in nanosecond
|
119
|
+
resolution. ngtcp2 cares about the difference from that initial
|
120
|
+
value. It could be any timestamp which increases monotonically, and
|
121
|
+
actual value does not matter.
|
122
|
+
|
123
|
+
:type:`ngtcp2_transport_params` contains QUIC transport parameters
|
124
|
+
which is sent to a remote endpoint during handshake. All fields must
|
125
|
+
be set. Application should call `ngtcp2_transport_params_default()`
|
126
|
+
to set the default values.
|
127
|
+
|
128
|
+
Client application has to supply Connection IDs to
|
129
|
+
`ngtcp2_conn_client_new()`. The *dcid* parameter is the destination
|
130
|
+
connection ID (DCID), and which should be random byte string and at
|
131
|
+
least 8 bytes long. The *scid* is the source connection ID (SCID)
|
132
|
+
which identifies the client itself. The *version* parameter is the
|
133
|
+
QUIC version to use. It should be :macro:`NGTCP2_PROTO_VER_V1`.
|
134
|
+
|
135
|
+
Similarly, server application has to supply these parameters to
|
136
|
+
`ngtcp2_conn_server_new()`. But the *dcid* must be the same value
|
137
|
+
which is received from client (which is client SCID). The *scid* is
|
138
|
+
chosen by server. Don't use DCID in client packet as server SCID.
|
139
|
+
The *version* parameter is the QUIC version to use. It should be
|
140
|
+
:macro:`NGTCP2_PROTO_VER_V1`.
|
141
|
+
|
142
|
+
A path is very important to QUIC connection. It is the pair of
|
143
|
+
endpoints, local and remote. The path passed to
|
144
|
+
`ngtcp2_conn_client_new()` and `ngtcp2_conn_server_new()` is a network
|
145
|
+
path that handshake is performed. The path must not change during
|
146
|
+
handshake. After handshake is confirmed, client can migrate to new
|
147
|
+
path. An application must provide actual path to the API function to
|
148
|
+
tell the library where a packet comes from. The "write" API function
|
149
|
+
takes path parameter and fills it to which the packet should be sent.
|
150
|
+
|
151
|
+
TLS integration
|
152
|
+
---------------
|
153
|
+
|
154
|
+
Use of :doc:`ngtcp2 crypto API <crypto_apiref>` is strongly
|
155
|
+
recommended because it vastly simplifies the TLS integration.
|
156
|
+
|
157
|
+
The most of the TLS work is done by the callback functions passed to
|
158
|
+
:type:`ngtcp2_callbacks` object. There are some operations left to
|
159
|
+
application in order to make TLS integration work. We have a set of
|
160
|
+
helper functions to make it easier for applications to configure TLS
|
161
|
+
stack object to work with QUIC and ngtcp2. They are specific to each
|
162
|
+
supported TLS stack:
|
163
|
+
|
164
|
+
- OpenSSL
|
165
|
+
|
166
|
+
* `ngtcp2_crypto_openssl_configure_client_context`
|
167
|
+
* `ngtcp2_crypto_openssl_configure_server_context`
|
168
|
+
|
169
|
+
- BoringSSL
|
170
|
+
|
171
|
+
* `ngtcp2_crypto_boringssl_configure_client_context`
|
172
|
+
* `ngtcp2_crypto_boringssl_configure_server_context`
|
173
|
+
|
174
|
+
- GnuTLS
|
175
|
+
|
176
|
+
* `ngtcp2_crypto_gnutls_configure_client_session`
|
177
|
+
* `ngtcp2_crypto_gnutls_configure_server_session`
|
178
|
+
|
179
|
+
- Picotls
|
180
|
+
|
181
|
+
* `ngtcp2_crypto_picotls_configure_client_context`
|
182
|
+
* `ngtcp2_crypto_picotls_configure_server_context`
|
183
|
+
* `ngtcp2_crypto_picotls_configure_client_session`
|
184
|
+
* `ngtcp2_crypto_picotls_configure_server_session`
|
185
|
+
|
186
|
+
- wolfSSL
|
187
|
+
|
188
|
+
* `ngtcp2_crypto_wolfssl_configure_client_context`
|
189
|
+
* `ngtcp2_crypto_wolfssl_configure_server_context`
|
190
|
+
|
191
|
+
They make the minimal QUIC specific changes to TLS stack object. See
|
192
|
+
the ngtcp2 crypto API header files for each supported TLS stack. In
|
193
|
+
order to make these functions work, we require that a pointer to
|
194
|
+
:type:`ngtcp2_crypto_conn_ref` must be set as a user data in TLS stack
|
195
|
+
object, and its :member:`ngtcp2_crypto_conn_ref.get_conn` must point
|
196
|
+
to a function which returns :type:`ngtcp2_conn` of the underlying QUIC
|
197
|
+
connection.
|
198
|
+
|
199
|
+
If you do not use the above helper functions, you need to generate and
|
200
|
+
install keys to :type:`ngtcp2_conn`, and pass handshake messages to
|
201
|
+
:type:`ngtcp2_conn` as well. When TLS stack generates new secrets,
|
202
|
+
they have to be installed to :type:`ngtcp2_conn` by calling
|
203
|
+
`ngtcp2_crypto_derive_and_install_rx_key()` and
|
204
|
+
`ngtcp2_crypto_derive_and_install_tx_key()`. When TLS stack generates
|
205
|
+
new crypto data to send, they must be passed to :type:`ngtcp2_conn` by
|
206
|
+
calling `ngtcp2_conn_submit_crypto_data()`.
|
207
|
+
|
208
|
+
When QUIC handshake is completed,
|
209
|
+
:member:`ngtcp2_callbacks.handshake_completed` callback function is
|
210
|
+
called. The local and remote endpoint independently declare handshake
|
211
|
+
completion. The endpoint has to confirm that the other endpoint also
|
212
|
+
finished handshake. When the handshake is confirmed, client side
|
213
|
+
:type:`ngtcp2_conn` will call
|
214
|
+
:member:`ngtcp2_callbacks.handshake_confirmed` callback function.
|
215
|
+
Server confirms handshake when it declares handshake completion,
|
216
|
+
therefore, separate handshake confirmation callback is not called.
|
217
|
+
|
218
|
+
Read and write packets
|
219
|
+
----------------------
|
220
|
+
|
221
|
+
`ngtcp2_conn_read_pkt()` processes the incoming QUIC packets. In
|
222
|
+
order to write QUIC packets, call `ngtcp2_conn_writev_stream()` or
|
223
|
+
`ngtcp2_conn_write_pkt()`. The *destlen* parameter must be at least
|
224
|
+
the value returned from `ngtcp2_conn_get_max_tx_udp_payload_size()`.
|
225
|
+
|
226
|
+
In order to send stream data, the application has to first open a
|
227
|
+
stream. Use `ngtcp2_conn_open_bidi_stream()` to open bidirectional
|
228
|
+
stream. For unidirectional stream, call
|
229
|
+
`ngtcp2_conn_open_uni_stream()`. Call `ngtcp2_conn_writev_stream()`
|
230
|
+
to send stream data.
|
231
|
+
|
232
|
+
An application should pace sending packets.
|
233
|
+
`ngtcp2_conn_get_send_quantum()` returns the number of bytes that can
|
234
|
+
be sent without packet spacing. After one or more calls of
|
235
|
+
`ngtcp2_conn_writev_stream()` (it can be called multiple times to fill
|
236
|
+
the buffer sized up to `ngtcp2_conn_get_send_quantum()` bytes), call
|
237
|
+
`ngtcp2_conn_update_pkt_tx_time()` to set the timer when the next
|
238
|
+
packet should be sent. The timer is integrated into
|
239
|
+
`ngtcp2_conn_get_expiry()`.
|
240
|
+
|
241
|
+
Packet handling on server side
|
242
|
+
------------------------------
|
243
|
+
|
244
|
+
Any incoming UDP datagram should be first processed by
|
245
|
+
`ngtcp2_pkt_decode_version_cid()`. It can handle Connection ID more
|
246
|
+
than 20 bytes which is the maximum length defined in QUIC v1. If the
|
247
|
+
function returns :macro:`NGTCP2_ERR_VERSION_NEGOTIATION`, server
|
248
|
+
should send Version Negotiation packet. Use
|
249
|
+
`ngtcp2_pkt_write_version_negotiation()` for this purpose. If
|
250
|
+
`ngtcp2_pkt_decode_version_cid()` succeeds, then check whether the UDP
|
251
|
+
datagram belongs to any existing connection by looking up connection
|
252
|
+
tables by Destination Connection ID (refer to the next section to know
|
253
|
+
how to associate Connection ID to a :type:`ngtcp2_conn`). If it
|
254
|
+
belongs to an existing connection, pass the UDP datagram to
|
255
|
+
`ngtcp2_conn_read_pkt()`. If it does not belong to any existing
|
256
|
+
connection, it should be passed to `ngtcp2_accept()`. If it returns
|
257
|
+
:macro:`NGTCP2_ERR_RETRY`, the server should send Retry packet (use
|
258
|
+
`ngtcp2_crypto_write_retry()` to create Retry packet). If it returns
|
259
|
+
an other negative error code, just drop the packet to the floor and
|
260
|
+
take no action, or send Stateless Reset packet (use
|
261
|
+
`ngtcp2_pkt_write_stateless_reset()` to create Stateless Reset
|
262
|
+
packet). Otherwise, the UDP datagram is acceptable as a new
|
263
|
+
connection. Create :type:`ngtcp2_conn` object and pass the UDP
|
264
|
+
datagram to `ngtcp2_conn_read_pkt()`.
|
265
|
+
|
266
|
+
Associating Connection ID to ngtcp2_conn
|
267
|
+
----------------------------------------
|
268
|
+
|
269
|
+
Server needs to route an incoming UDP datagram to the correct
|
270
|
+
:type:`ngtcp2_conn` by its Destination Connection ID. When a UDP
|
271
|
+
datagram is received, and it does not belong to any existing
|
272
|
+
connections, and it is successfully processed by
|
273
|
+
`ngtcp2_conn_read_pkt()`, associate the Destination Connection ID in
|
274
|
+
the QUIC packet and :type:`ngtcp2_conn` object. The server must
|
275
|
+
associate the Connection ID returned by `ngtcp2_conn_get_scid()` to
|
276
|
+
the :type:`ngtcp2_conn` object as well. Use
|
277
|
+
`ngtcp2_conn_get_num_scid()` to get the number of Connection IDs that
|
278
|
+
`ngtcp2_conn_get_scid()` returns. When new Connection ID is asked by
|
279
|
+
the library, :member:`ngtcp2_callbacks.get_new_connection_id` is
|
280
|
+
called. Inside the callback, associate the newly generated Connection
|
281
|
+
ID to the :type:`ngtcp2_conn` object.
|
282
|
+
|
283
|
+
When Connection ID is no longer used, its association should be
|
284
|
+
removed. When Connection ID is retired,
|
285
|
+
:member:`ngtcp2_callbacks.remove_connection_id` is called. Inside the
|
286
|
+
callback, remove the association for the Connection ID.
|
287
|
+
|
288
|
+
When a QUIC connection is closed, all associations for the connection
|
289
|
+
should be removed. Remove all associations for Connection ID returned
|
290
|
+
from `ngtcp2_conn_get_scid()`. Association for the initial Connection
|
291
|
+
ID which can be obtained by calling
|
292
|
+
`ngtcp2_conn_get_client_initial_dcid()` should also be removed.
|
293
|
+
|
294
|
+
Dealing with early data
|
295
|
+
-----------------------
|
296
|
+
|
297
|
+
Client application has to load resumed TLS session. It also has to
|
298
|
+
set the remembered transport parameters using
|
299
|
+
`ngtcp2_conn_set_early_remote_transport_params()` function.
|
300
|
+
|
301
|
+
Other than that, there is no difference between early data and 1RTT
|
302
|
+
data in terms of API usage.
|
303
|
+
|
304
|
+
If early data is rejected by a server, client must call
|
305
|
+
`ngtcp2_conn_early_data_rejected`. All connection states altered
|
306
|
+
during early data transmission are undone. The library does not
|
307
|
+
retransmit early data to server as 1RTT data. If an application
|
308
|
+
wishes to resend data, it has to reopen streams and writes data again.
|
309
|
+
See `ngtcp2_conn_early_data_rejected`.
|
310
|
+
|
311
|
+
Stream data ownership
|
312
|
+
--------------------------------
|
313
|
+
|
314
|
+
Stream data passed to :type:`ngtcp2_conn` must be held by application
|
315
|
+
until :member:`ngtcp2_callbacks.acked_stream_data_offset` callbacks is
|
316
|
+
invoked, telling that the those data are acknowledged by the remote
|
317
|
+
endpoint and no longer used by the library.
|
318
|
+
|
319
|
+
Timers
|
320
|
+
------
|
321
|
+
|
322
|
+
The library does not ask an operating system for any timestamp.
|
323
|
+
Instead, an application has to supply timestamp to the library. The
|
324
|
+
type of timestamp in ngtcp2 library is :type:`ngtcp2_tstamp` which is
|
325
|
+
nanosecond resolution. The library only cares the difference of
|
326
|
+
timestamp, so it does not have to be a system clock. A monotonic
|
327
|
+
clock should work better. It should be same clock passed to
|
328
|
+
:member:`ngtcp2_settings.initial_ts`. The duration in ngtcp2 library
|
329
|
+
is :type:`ngtcp2_duration` which is also nanosecond resolution.
|
330
|
+
|
331
|
+
`ngtcp2_conn_get_expiry()` tells an application when timer fires.
|
332
|
+
When it fires, call `ngtcp2_conn_handle_expiry()`. If it returns
|
333
|
+
:macro:`NGTCP2_ERR_IDLE_CLOSE`, it means that an idle timer has fired
|
334
|
+
for this particular connection. In this case, drop the connection
|
335
|
+
without calling `ngtcp2_conn_write_connection_close()`. Otherwise,
|
336
|
+
call `ngtcp2_conn_writev_stream()`. After calling
|
337
|
+
`ngtcp2_conn_handle_expiry()` and `ngtcp2_conn_writev_stream()`, new
|
338
|
+
expiry is set. The application should call `ngtcp2_conn_get_expiry()`
|
339
|
+
to get a new deadline.
|
340
|
+
|
341
|
+
Please note that :type:`ngtcp2_tstamp` of value ``UINT64_MAX`` is
|
342
|
+
treated as an invalid timestamp. Do not pass ``UINT64_MAX`` to any
|
343
|
+
ngtcp2 functions which take :type:`ngtcp2_tstamp` unless it is
|
344
|
+
explicitly allowed.
|
345
|
+
|
346
|
+
Connection migration
|
347
|
+
--------------------
|
348
|
+
|
349
|
+
In QUIC, client application can migrate to a new local address.
|
350
|
+
`ngtcp2_conn_initiate_immediate_migration()` migrates to a new local
|
351
|
+
address without checking reachability. On the other hand,
|
352
|
+
`ngtcp2_conn_initiate_migration()` migrates to a new local address
|
353
|
+
after a new path is validated (thus reachability is established).
|
354
|
+
|
355
|
+
Closing connection abruptly
|
356
|
+
---------------------------
|
357
|
+
|
358
|
+
In order to close QUIC connection abruptly, call
|
359
|
+
`ngtcp2_conn_write_connection_close()` and get a terminal packet.
|
360
|
+
After the call, the connection enters the closing state.
|
361
|
+
|
362
|
+
The closing and draining state
|
363
|
+
------------------------------
|
364
|
+
|
365
|
+
After the successful call of `ngtcp2_conn_write_connection_close()`,
|
366
|
+
the connection enters the closing state. When
|
367
|
+
`ngtcp2_conn_read_pkt()` returns :macro:`NGTCP2_ERR_DRAINING`, the
|
368
|
+
connection has entered the draining state. In these states,
|
369
|
+
`ngtcp2_conn_writev_stream()` and `ngtcp2_conn_read_pkt()` return an
|
370
|
+
error (either :macro:`NGTCP2_ERR_CLOSING` or
|
371
|
+
:macro:`NGTCP2_ERR_DRAINING` depending on the state).
|
372
|
+
`ngtcp2_conn_write_connection_close()` returns 0 in these states. If
|
373
|
+
an application needs to send a packet containing CONNECTION_CLOSE
|
374
|
+
frame in the closing state, resend the packet produced by the first
|
375
|
+
call of `ngtcp2_conn_write_connection_close()`. Therefore, after a
|
376
|
+
connection has entered one of these states, the application can
|
377
|
+
discard :type:`ngtcp2_conn` object. The closing and draining state
|
378
|
+
should persist at least 3 times the current PTO.
|
379
|
+
|
380
|
+
Error handling in general
|
381
|
+
-------------------------
|
382
|
+
|
383
|
+
In general, when error is returned from the ngtcp2 library function,
|
384
|
+
call `ngtcp2_conn_write_connection_close()` to get terminal packet.
|
385
|
+
If the successful call of the function creates non-empty packet, the
|
386
|
+
QUIC connection enters the closing state.
|
387
|
+
|
388
|
+
If :macro:`NGTCP2_ERR_DROP_CONN` is returned from
|
389
|
+
`ngtcp2_conn_read_pkt`, a connection should be dropped without calling
|
390
|
+
`ngtcp2_conn_write_connection_close()`. Similarly, if
|
391
|
+
:macro:`NGTCP2_ERR_IDLE_CLOSE` is returned from
|
392
|
+
`ngtcp2_conn_handle_expiry`, a connection should be dropped without
|
393
|
+
calling `ngtcp2_conn_write_connection_close()`. If
|
394
|
+
:macro:`NGTCP2_ERR_DRAINING` is returned from `ngtcp2_conn_read_pkt`,
|
395
|
+
a connection has entered the draining state, and no further packet
|
396
|
+
transmission is allowed.
|
397
|
+
|
398
|
+
The following error codes must be considered as transitional, and
|
399
|
+
application should keep connection alive:
|
400
|
+
|
401
|
+
* :macro:`NGTCP2_ERR_STREAM_DATA_BLOCKED`
|
402
|
+
* :macro:`NGTCP2_ERR_STREAM_SHUT_WR`
|
403
|
+
* :macro:`NGTCP2_ERR_STREAM_NOT_FOUND`
|
404
|
+
* :macro:`NGTCP2_ERR_STREAM_ID_BLOCKED`
|
405
|
+
|
406
|
+
Version negotiation
|
407
|
+
-------------------
|
408
|
+
|
409
|
+
Version negotiation is configured with the following
|
410
|
+
:type:`ngtcp2_settings` fields:
|
411
|
+
|
412
|
+
* :member:`ngtcp2_settings.preferred_versions` and
|
413
|
+
:member:`ngtcp2_settings.preferred_versionslen`
|
414
|
+
* :member:`ngtcp2_settings.available_versions` and
|
415
|
+
:member:`ngtcp2_settings.available_versionslen`
|
416
|
+
* :member:`ngtcp2_settings.original_version`
|
417
|
+
|
418
|
+
*client_chosen_version* passed to `ngtcp2_conn_client_new` also
|
419
|
+
influence the version negotiation process.
|
420
|
+
|
421
|
+
By default, client sends *client_chosen_version* passed to
|
422
|
+
`ngtcp2_conn_client_new` in available_versions field of
|
423
|
+
version_information QUIC transport parameter. That means there is no
|
424
|
+
chance for server to select the other compatible version. Meanwhile,
|
425
|
+
ngtcp2 supports QUIC v2 version (:macro:`NGTCP2_PROTO_VER_V2`).
|
426
|
+
Including both :macro:`NGTCP2_PROTO_VER_V1` and
|
427
|
+
:macro:`NGTCP2_PROTO_VER_V2` in
|
428
|
+
:member:`ngtcp2_settings.available_versions` field allows server to
|
429
|
+
choose :macro:`NGTCP2_PROTO_VER_V2` which is compatible to
|
430
|
+
:macro:`NGTCP2_PROTO_VER_V1`.
|
431
|
+
|
432
|
+
By default, server sends :macro:`NGTCP2_PROTO_VER_V1` in
|
433
|
+
available_versions field of version_information QUIC transport
|
434
|
+
parameter. Because there is no particular preferred versions
|
435
|
+
specified, server will accept any supported version. In order to set
|
436
|
+
the version preference, specify
|
437
|
+
:member:`ngtcp2_settings.preferred_versions` field. If it is
|
438
|
+
specified, server sends them in available_versions field of
|
439
|
+
version_information QUIC transport parameter unless
|
440
|
+
:member:`ngtcp2_settings.available_versionslen` is not zero.
|
441
|
+
Specifying :member:`ngtcp2_settings.available_versions` overrides the
|
442
|
+
above mentioned default behavior. Even if there is no overlap between
|
443
|
+
:member:`ngtcp2_settings.preferred_versions` and available_versions
|
444
|
+
field plus *client_chosen_version* from client, as long as
|
445
|
+
*client_chosen_version* is supported by server, server accepts
|
446
|
+
*client_chosen_version*.
|
447
|
+
|
448
|
+
If client receives Version Negotiation packet from server,
|
449
|
+
`ngtcp2_conn_read_pkt` returns
|
450
|
+
:macro:`NGTCP2_ERR_RECV_VERSION_NEGOTIATION`.
|
451
|
+
:member:`ngtcp2_callbacks.recv_version_negotiation` is also invoked if
|
452
|
+
set. It will provide the versions contained in the packet. Client
|
453
|
+
then either gives up the connection attempt, or selects the version
|
454
|
+
from Version Negotiation packet, and starts new connection attempt
|
455
|
+
with that version. In the latter case, the initial version that used
|
456
|
+
in the first connection attempt must be set to
|
457
|
+
:member:`ngtcp2_settings.original_version`. The client version
|
458
|
+
preference that is used when selecting a version from Version
|
459
|
+
Negotiation packet must be set to
|
460
|
+
:member:`ngtcp2_settings.preferred_versions`.
|
461
|
+
:member:`ngtcp2_settings.available_versions` must include the selected
|
462
|
+
version. The selected version becomes *client_chosen_version* in the
|
463
|
+
second connection attempt, and must be passed to
|
464
|
+
`ngtcp2_conn_client_new`.
|
465
|
+
|
466
|
+
Server never know whether client reacted upon Version Negotiation
|
467
|
+
packet or not, and there is no particular setup for server to make
|
468
|
+
this incompatible version negotiation work.
|
469
|
+
|
470
|
+
Thread safety
|
471
|
+
-------------
|
472
|
+
|
473
|
+
ngtcp2 library is thread-safe as long as a single :type:`ngtcp2_conn`
|
474
|
+
object is accessed by a single thread at a time. For multi-threaded
|
475
|
+
applications, it is recommended to create :type:`ngtcp2_conn` objects
|
476
|
+
per thread to avoid locks.
|
@@ -0,0 +1,39 @@
|
|
1
|
+
FROM debian:11 as build
|
2
|
+
|
3
|
+
RUN apt-get update && \
|
4
|
+
apt-get install -y --no-install-recommends \
|
5
|
+
git g++ clang-11 make binutils autoconf automake autotools-dev libtool \
|
6
|
+
pkg-config libev-dev libjemalloc-dev \
|
7
|
+
ca-certificates mime-support && \
|
8
|
+
git clone --depth 1 -b OpenSSL_1_1_1t+quic https://github.com/quictls/openssl && \
|
9
|
+
cd openssl && ./config --openssldir=/etc/ssl && make -j$(nproc) && make install_sw && cd .. && rm -rf openssl && \
|
10
|
+
git clone --depth 1 https://github.com/ngtcp2/nghttp3 && \
|
11
|
+
cd nghttp3 && autoreconf -i && \
|
12
|
+
./configure --enable-lib-only CC=clang-11 CXX=clang++-11 && \
|
13
|
+
make -j$(nproc) && make install-strip && cd .. && rm -rf nghttp3 && \
|
14
|
+
git clone --depth 1 https://github.com/ngtcp2/ngtcp2 && \
|
15
|
+
cd ngtcp2 && autoreconf -i && \
|
16
|
+
./configure \
|
17
|
+
CC=clang-11 \
|
18
|
+
CXX=clang++-11 \
|
19
|
+
LIBTOOL_LDFLAGS="-static-libtool-libs" \
|
20
|
+
OPENSSL_LIBS="-l:libssl.a -l:libcrypto.a -ldl -pthread" \
|
21
|
+
LIBEV_LIBS="-l:libev.a" \
|
22
|
+
JEMALLOC_LIBS="-l:libjemalloc.a -lm" && \
|
23
|
+
make -j$(nproc) && \
|
24
|
+
strip examples/client examples/server && \
|
25
|
+
cp examples/client examples/server /usr/local/bin && \
|
26
|
+
cd .. && rm -rf ngtcp2 && \
|
27
|
+
apt-get -y purge \
|
28
|
+
git g++ clang-11 make binutils autoconf automake autotools-dev libtool \
|
29
|
+
pkg-config libev-dev libjemalloc-dev \
|
30
|
+
ca-certificates && \
|
31
|
+
apt-get -y autoremove --purge && \
|
32
|
+
rm -rf /var/log/*
|
33
|
+
|
34
|
+
FROM gcr.io/distroless/cc-debian11:latest-amd64
|
35
|
+
|
36
|
+
COPY --from=build /usr/local/bin/client /usr/local/bin/server /usr/local/bin/
|
37
|
+
COPY --from=build /etc/mime.types /etc/
|
38
|
+
|
39
|
+
CMD ["/usr/local/bin/client"]
|