XQUIC Library released by Alibaba is a cross-platform implementation of QUIC and HTTP/3 protocol.

XQUIC

xquic logo

GitHub Build CodeQL Codacy Badge Codacy Badge Platforms

简体中文文档 README-zh-CN

Introduction

XQUIC Library released by Alibaba is …

a client and server implementation of QUIC and HTTP/3 as specified by the IETF. Currently supported QUIC versions are v1 and draft-29.

OS and platform agnostic. It currently supports Android, iOS, Linux, macOS and Windows. Most of the code is used in our own products, and has been tested at scale on android, iOS apps, as well as servers.

still in active development. Interoperability is regularly tested with other QUIC implementations.

Requirements

To build XQUIC, you need

  • CMake
  • BoringSSL or BabaSSL

To run test cases, you need

  • libevent
  • CUnit

QuickStart Guide

XQUIC supports both BabaSSL and BoringSSL.

Build with BoringSSL

# get XQUIC source code
git clone [email protected]:alibaba/xquic.git
cd xquic

# get and build BoringSSL
git clone [email protected]:google/boringssl.git ./third_party/boringssl
cd ./third_party/boringssl
mkdir -p build && cd build
cmake -DBUILD_SHARED_LIBS=0 -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC" ..
make ssl crypto
cd ..
SSL_TYPE_STR="boringssl"
SSL_PATH_STR="${PWD}"
SSL_INC_PATH_STR="${PWD}/include"
SSL_LIB_PATH_STR="${PWD}/build/ssl/libssl.a;${PWD}/build/crypto/libcrypto.a"
cd ../..

# build XQUIC with BoringSSL
git submodule update --init --recursive
mkdir -p build; cd build
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_DISABLE_RENO=0 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
make -j

Build with BabaSSL

# get XQUIC source code
git clone [email protected]:alibaba/xquic.git
cd xquic

# get and build BabaSSL
git clone [email protected]:BabaSSL/BabaSSL.git ./third_party/babassl
cd ./third_party/babassl/
./config --prefix=/usr/local/babassl
make -j
SSL_TYPE_STR="babassl"
SSL_PATH_STR="${PWD}"
SSL_INC_PATH_STR="${PWD}/include"
SSL_LIB_PATH_STR="${PWD}/libssl.a;${PWD}/libcrypto.a"
cd -

# build XQUIC with BabaSSL
git submodule update --init --recursive
mkdir -p build; cd build
cmake -DGCOV=on -DCMAKE_BUILD_TYPE=Debug -DXQC_ENABLE_TESTING=1 -DXQC_SUPPORT_SENDMMSG_BUILD=1 -DXQC_ENABLE_EVENT_LOG=1 -DXQC_ENABLE_BBR2=1 -DXQC_DISABLE_RENO=0 -DSSL_TYPE=${SSL_TYPE_STR} -DSSL_PATH=${SSL_PATH_STR} -DSSL_INC_PATH=${SSL_INC_PATH_STR} -DSSL_LIB_PATH=${SSL_LIB_PATH_STR} ..
make -j

Run testcases

sh ../scripts/xquic_test.sh

Documentation

Contributing

We would love for you to contribute to XQUIC and help make it even better than it is today! All types of contributions are encouraged and valued. Thanks to all contributors. See our Contributing Guidelines for more information.

If you have any questions, please feel free to open a new Discussion topic in our discussion forums.

License

XQUIC is released under the Apache 2.0 License.

Contact Us

Feel free to contact us in the following ways:

  • e-mail: [email protected]

  • Dingtalk group: 34059705

  • slack channel: #xquic in quicdev group

    dingtalk group
Owner
Alibaba
Alibaba Open Source
Alibaba
Comments
  • [Bug]: Division-by-zero exception caused by return value of xqc_pacing_rate_calc()

    [Bug]: Division-by-zero exception caused by return value of xqc_pacing_rate_calc()

    What happened?

    Function xqc_pacing_rate_calc() can returned 0 in some case (I encountered this problem once, not sure how to reproduce), and causing division-by-zero exception in xqc_pacing_time_until_send() at this line: https://github.com/alibaba/xquic/blob/7f362ee085a4a1eeb48fb7f90a3ae07f24481872/src/transport/xqc_pacing.c#L122

    Steps To Reproduce

    I encountered this problem once, not sure how to reproduce.

    Relevant log output

    No response

  • [Bug]: build error

    [Bug]: build error

    What happened?

    Build error happens when I run "make -j"

    Steps To Reproduce

    Follow the README

    Relevant log output

    ld: unknown option: --whole-archive
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make[2]: *** [libxquic.dylib] Error 1
    make[1]: *** [CMakeFiles/xquic.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    [ 90%] Built target xquic-static
    make: *** [all] Error 2
    
  • [Bug]: send stream packet 1Mbps get drop rate, the stream is unreliability and unstability

    [Bug]: send stream packet 1Mbps get drop rate, the stream is unreliability and unstability

    What happened?

    1 Forward or schedule packet to xquic, send stream packet use function bellow void client_network_send(void *out_data, size_t out_dlen) { g_user_stream->send_body = out_data; g_user_stream->send_body_len = out_dlen; g_user_stream->send_offset = 0; client_stream_send(g_user_stream->stream, g_user_stream); }

    2 Send iperf udp packet in limited bandwidth and get the packet lost

    iperf -u -c 10.7.0.1 -b 1M -t 10 -p 6001 // drop rate 20% iperf -u -c 10.7.0.1 -b 2M -t 10 -p 6001 // drop rate 50%

    image

    3 The stream transport is unreliability and unstability 3.1 server stream segmentation fault image

    3.2 server close stream actively image

    3.3 client stream segmentation fault 1650855941(1)

    Steps To Reproduce

    1 Forward or schedule packet to xquic 2 send packet with function client_network_send( ) 3 use iperf test tool to detect the udp throughput 4 get some drop rate and unstability

    Relevant log output

    No response

  • test_client cannot connect with nginx-quic becauseof validate token failed

    test_client cannot connect with nginx-quic becauseof validate token failed

    Discussed in https://github.com/alibaba/xquic/discussions/87

    Originally posted by innocenceman February 16, 2022 What happened? xquic client connect to nginx-quic failed, and there is a error "quic garbage token while handling initial packet" in error.log xquic was built with boringssl, and the client is test_client, client show "conn errno:11" in the end.

    Steps To Reproduce download nginx-quic with version release-1.21.6, build and install it, run nginx with nginx.conf:"listen 8443 http3 reuseport". use test_client(command line: ./test_client -a xxx.xxx.xxx.xxx -p xxxx -G -l e -u https://www.xxxxx.com/) to request nginx-quic server.

    thanks xquic.zip

  • [Bug]: send stream fragment packet, drop rate 75%

    [Bug]: send stream fragment packet, drop rate 75%

    What happened?

    1 Forward or schedule packet to xquic, send stream packet use function bellow void client_network_send(void *out_data, size_t out_dlen) { g_user_stream->send_body = out_data; g_user_stream->send_body_len = out_dlen; g_user_stream->send_offset = 0; client_stream_send(g_user_stream->stream, g_user_stream); }

    2 Send packet fragmentation would makes packet drop

    3 Looks like transport stream packets have scheduling issue

    Steps To Reproduce

    1 forward or schedule packet to xquic 2 send packet with function client_network_send( ) 3 send packet with fragmentation gets packet drop

    Relevant log output

    No response

  • [Bug]: xqc_build.sh build iOS failed

    [Bug]: xqc_build.sh build iOS failed

    What happened?

    As discussions #21 , build iOS failed using xqc_build.sh

    Steps To Reproduce

    As discussions #21

    macOS 11.4 Xcode 12.5 cmake version 3.21.2

    1.export IOS_CMAKE_TOOLCHAIN="xx/xquic/cmake/ios.toolchain.cmake" 2. sh xqc_build.sh ios ios_build ios_release xxx/xquic/third_party/boringssl

    output: [ 1%] Generating crypto_test_data.cc make[2]: *** No rule to make target xxx/xquic/bssl_symbols.txt', needed by third_party/boringssl/symbol_prefix_include/boringssl_prefix_symbols.h'. Stop. make[1]: *** [third_party/boringssl/CMakeFiles/boringssl_prefix_symbols.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 1%] Building CXX object third_party/boringssl/CMakeFiles/boringssl_gtest.dir/third_party/googletest/src/gtest-all.cc.o [ 1%] Building CXX object third_party/boringssl/CMakeFiles/crypto_test_data.dir/crypto_test_data.cc.o [ 1%] Built target crypto_test_data [ 1%] Linking CXX static library ../../outputs/libboringssl_gtest.a [ 1%] Built target boringssl_gtest make: *** [all] Error 2

    Relevant log output

    No response

  • [Bug]:xquic在windows下编译有错误

    [Bug]:xquic在windows下编译有错误

    What happened?

    按照最新版本的xquic中的platforms中在win10 64位上编译xquic,一直都报错,无法解决

    Steps To Reproduce

    windows环境: Win10 64位系统

    软件版本: Go:1.18.1 Cmake:3.23.1 Nasm:2.15 Visual studio:2017 因为环境不联网,没有办法下载安装vcpkg,从而libevent是自己离线安装的

    编译步骤: (1) 编译boringssl 当前下载的是4.23号的master分支代码,使用的是vs2017下的命令行提示符 如果按照platforms下的命令运行, cmake -DCMAKE_GENERATOR_PLATFORM=x64 --config Debug -DBUILD_SHARED_LIBS=0 -DCMAKE_C_FLAGS="-fPIC" -DCMAKE_CXX_FLAGS="-fPIC" .. 会报错,cmake error:unknown argument --config:

    将config命令去掉,成功不报错

    设置 set GO111MODULE=off 运行MSBuild.exe ALL_BUILD.vcxproj,生成lib

    (2) 编译xquic 运行命令: cmake -DSSL_TYPE=boringssl -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 15 2017 Win64" .. 不报错 继续运行: MSBuild.exe ALL_BUILD.vcxproj 会报一堆无法解析的错误 22

    Relevant log output

    No response

  • [Feature]: Retry support

    [Feature]: Retry support

    What happened?

    Xquic client can't complete handshake with quic-go server. Xquic was built with babassl, and it keep retrying when handshake with quic-go server.

    Steps To Reproduce

    Attached test client and server source file. Client can get connect_create_notify called but connect_handshake_finished never got called.

    thanks

    xquic.zip

    Relevant log output

    No response

  • [Bug]: compile failed due to BabaSSL break change?

    [Bug]: compile failed due to BabaSSL break change?

    What happened?

    Seems BabaSSL has break changes, they renamed to Tongsuo.

    /extern_disk/home/lyf/xquic/src/transport/xqc_packet_parser.c: In function ‘xqc_gen_reset_token’:
    /extern_disk/home/lyf/xquic/src/transport/xqc_packet_parser.c:1300:5: error: ‘HMAC_CTX_new’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
         HMAC_CTX *ctx = HMAC_CTX_new();
         ^~~~~~~~
    In file included from /extern_disk/home/lyf/xquic/src/transport/xqc_packet_parser.c:9:0:
    /extern_disk/home/lyf/xquic/third_party/babassl/include/openssl/hmac.h:33:33: note: declared here
     OSSL_DEPRECATEDIN_3_0 HMAC_CTX *HMAC_CTX_new(void);
                                     ^~~~~~~~~~~~
    /extern_disk/home/lyf/xquic/src/transport/xqc_packet_parser.c:1301:5: error: ‘HMAC_CTX_reset’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
         HMAC_CTX_reset(ctx);
         ^~~~~~~~~~~~~~
    In file included from /extern_disk/home/lyf/xquic/src/transport/xqc_packet_parser.c:9:0:
    /extern_disk/home/lyf/xquic/third_party/babassl/include/openssl/hmac.h:34:27: note: declared here
     OSSL_DEPRECATEDIN_3_0 int HMAC_CTX_reset(HMAC_CTX *ctx);
                               ^~~~~~~~~~~~~~
    /extern_disk/home/lyf/xquic/src/transport/xqc_packet_parser.c:1302:5: error: ‘HMAC_Init_ex’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
         HMAC_Init_ex(ctx, key, keylen, engine, NULL);
         ^~~~~~~~~~~~
    In file included from /extern_disk/home/lyf/xquic/src/transport/xqc_packet_parser.c:9:0:
    /extern_disk/home/lyf/xquic/third_party/babassl/include/openssl/hmac.h:43:27: note: declared here
     OSSL_DEPRECATEDIN_3_0 int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
                               ^~~~~~~~~~~~
    /extern_disk/home/lyf/xquic/src/transport/xqc_packet_parser.c:1303:5: error: ‘HMAC_Update’ is deprecated: Since OpenSSL 3.0 [-Werror=deprecated-declarations]
         HMAC_Update(ctx, input, input_len);
         ^~~~~~~~~~~
    In file included from /extern_disk/home/lyf/xquic/src/transport/xqc_packet_parser.c:9:0:
    /extern_disk/home/lyf/xquic/third_party/babassl/include/openssl/hmac.h:45:27: note: declared here
     OSSL_DEPRECATEDIN_3_0 int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data,
                               ^~~~~~~~~~~
    .......
    .......
    

    Steps To Reproduce

    just compile xquic following the build doc.

    Relevant log output

    No response

  • [Feature]: FEC/RED functionality in the future?

    [Feature]: FEC/RED functionality in the future?

    Before request a new feature

    • [X] I have searched the issues of this repository and believe that this is not a duplicate.

    Describe the feature you'd like supported

    reference to RFC 2198、RFC 2733

    Describe alternatives you've considered

    No response

    Additional context

    No response

  • fix a few gramma errors in API documentation

    fix a few gramma errors in API documentation

    I found multiple typos in API.md. A few sentences are quite elusive to me. I changed them liberally. Please correct me if there are any distortions. I also found one comment (annotated with a TODO) repeated in different contexts,.

  • xqc_pow2 cann't work in windows.

    xqc_pow2 cann't work in windows.

    #include <assert.h>
    #include <math.h>
    #ifdef _WIN32
    #include <intrin.h>
    #define XQC_SYS_WINDOWS 1
    #endif
    /* make n to 2 pow  */
    static int xqc_pow2(unsigned int n)
    {
        int count1 = 0;    
        unsigned long power = sizeof(n);
    #ifdef __GNUC__
        count1 = __builtin_popcount(n);
    #else
        unsigned int t = n;
        while (t) {
            count1 += t & 1;
            t >>= 1;
        }
    #endif
        if (count1 <= 1) {
            return n;
        }
    #if defined(XQC_SYS_WINDOWS) && defined(_MSC_VER)
        /* __lzcnt available beginning VS2008 or up*/
        _BitScanReverse((unsigned long *)&power, n);    
    #else
        power = (power << 3) - __builtin_clz(n) - 1;    
    #endif
        return (int)pow(2, power);
    }
    int main()
    {
        assert(xqc_pow2(4) == 4);
        assert(xqc_pow2(12) == 8);
        assert(xqc_pow2(1024) == 1024);
        assert(xqc_pow2(0) == 0);
        assert(xqc_pow2(1) == 1);
    }
    
  • [Bug]: nonce computation error in multipath-ietf-draft-01 branch

    [Bug]: nonce computation error in multipath-ietf-draft-01 branch

    What happened?

    multipath的 nonce计算时 path id应该是网络序,现在貌似是主机序?

    问题可能出现在:https://github.com/alibaba/xquic/blob/ceeed29947e7ad148e097d75c26ba6407368af36/src/tls/xqc_crypto.c#L158

    Steps To Reproduce

    RFC测试实例:

    # https://quicwg.org/multipath/draft-ietf-quic-multipath.html#name-packet-protection-for-quic-
    
    IV: 6b26114b9cba2b63a9e8dd4f
    PN: aead
    SN: 3
    ==
    nonce: 6b2611489cba2b63a9e873e2
    

    Relevant log output

    No response

  • [Bug]: Address validation token is too easy.

    [Bug]: Address validation token is too easy.

    What happened?

    8.1.4.Address Validation Token Integrity An address validation token MUST be difficult to guess. Including a random value with at least 128 bits of entropy in the token would be sufficient, but this depends on the server remembering the value it sends to clients.

    Xquic use ip address + expire time as token.

    Steps To Reproduce

    Read the code.

    Relevant log output

    No response

  • [Bug]: Is there any serious test on xquic?

    [Bug]: Is there any serious test on xquic?

    What happened?

    I found many memory leak bugs, it seems xquic is not tested in extreme scenarios (e.g. high loss rate).

    Steps To Reproduce

    See my issues.

    Relevant log output

    No response

  • [Bug]: memory leak: xqc_process_crypto_frame: stream_frame

    [Bug]: memory leak: xqc_process_crypto_frame: stream_frame

    What happened?

    The memory allocate for stream_frame may leak.

    Steps To Reproduce

    valgrind it in high loss environment.

    Relevant log output

    No response

  • [Bug]: test_server.c may cause memory leak

    [Bug]: test_server.c may cause memory leak

    What happened?

    test_server.c allocate user date in server_accept callback, but free it in conn_close_notify callback, which may cause memory leak if a connection is closed before it get ALPN. This can be fixed by implementing the server_refuse callback, which is designed to work with server_accept in such scenarios.

    Steps To Reproduce

    Run it with valgrind in a high loss rate environment.

    Relevant log output

    No response

H2O - the optimized HTTP/1, HTTP/2, HTTP/3 server

H2O - an optimized HTTP server with support for HTTP/1.x, HTTP/2 and HTTP/3 (experimental) Copyright (c) 2014-2019 DeNA Co., Ltd., Kazuho Oku, Tatsuhi

Nov 27, 2022
QUIC, a multiplexed stream transport over UDP

QUIC, a multiplexed stream transport over UDP QUIC is an experimental protocol aimed at reducing web latency over that of TCP. On the surface, QUIC is

Dec 2, 2022
Simple HTTP protocol implementation in C

C-SimpleHTTP A simple HTTP protocol implementation in C How do i run it? First of all, this project is made in c, then you will need GCC Compiler. The

May 25, 2022
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket, MQTT built-in protocols, async DNS resolver, and non-blocking API.
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket,  MQTT built-in protocols, async DNS resolver, and non-blocking API.

Mongoose - Embedded Web Server / Embedded Networking Library Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs

Dec 2, 2022
Cross-platform, efficient, customizable, and robust asynchronous HTTP/WebSocket server C++14 library with the right balance between performance and ease of use

What Is RESTinio? RESTinio is a header-only C++14 library that gives you an embedded HTTP/Websocket server. It is based on standalone version of ASIO

Nov 25, 2022
Small and fast cross-platform networking library, with support for messaging, IPv6, HTTP, SSL and WebSocket.

frnetlib Frnetlib, is a cross-platform, small and fast networking library written in C++. There are no library dependencies (unless you want to use SS

May 16, 2022
A cross-platform HTTP client library with a focus on usability and speed

EasyHttp A cross-platform HTTP client library with a focus on usability and speed. Under its hood, EasyHttp uses POCO C++ Libraries and derives many o

Nov 9, 2022
Tiny cross-platform HTTP / HTTPS client library in C.

naett /nɛt:/ Tiny HTTP client library in C. Wraps native HTTP client functionality on macOS, Windows, Linux, iOS and Android in a single, simple non-b

Nov 19, 2022
SoftEther VPN - Cross-platform multi-protocol VPN software.
 SoftEther VPN - Cross-platform multi-protocol VPN software.

SoftEther VPN - Cross-platform multi-protocol VPN software.

Nov 23, 2022
aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line.

aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink.

Nov 22, 2022
modern c++(c++17), cross-platform, header-only, easy to use http framework
modern c++(c++17), cross-platform, header-only, easy to use http framework

cinatra--一个高效易用的c++ http框架 English | 中文 目录 使用cinatra常见问题汇总(FAQ) cinatra简介 如何使用 快速示例 性能测试 注意事项 roadmap 联系方式 cinatra简介 cinatra是一个高性能易用的http框架,它是用modern

Nov 28, 2022
A cross-platform network learning demos. Like high-performance http server

Network-Learn A cross-platform network learning demos (toys). And I try not to use 3rd-party libraries. Welcome to try it out and leave your comments.

Sep 6, 2022
Cross-platform, single .h file HTTP server (Windows, Linux, Mac OS X)

EWS - Single .h File C Embeddable Web Server Latest Version: 1.1.4 released September 9, 2021 Supported platforms: Linux, Mac OS X, Windows License: B

Nov 18, 2022
Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services.
Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services.

Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services. The project is unique among realtime push solutions in that it is designed to address the needs of API creators. Pushpin is transparent to clients and integrates easily into an API stack.

Nov 24, 2022
Gromox - Groupware server backend with MAPI/HTTP, RPC/HTTP, IMAP, POP3 and PHP-MAPI support for grommunio

Gromox is the central groupware server component of grommunio. It is capable of serving as a replacement for Microsoft Exchange and compatibles. Conne

Nov 26, 2022
tiny HTTP parser written in C (used in HTTP::Parser::XS et al.)
tiny HTTP parser written in C (used in HTTP::Parser::XS et al.)

PicoHTTPParser Copyright (c) 2009-2014 Kazuho Oku, Tokuhiro Matsuno, Daisuke Murase, Shigeo Mitsunari PicoHTTPParser is a tiny, primitive, fast HTTP r

Nov 23, 2022
A collection of C++ HTTP libraries including an easy to use HTTP server.
A collection of C++ HTTP libraries including an easy to use HTTP server.

Proxygen: Facebook's C++ HTTP Libraries This project comprises the core C++ HTTP abstractions used at Facebook. Internally, it is used as the basis fo

Nov 25, 2022
cuehttp is a modern c++ middleware framework for http(http/https)/websocket(ws/wss).

cuehttp 简介 cuehttp是一个使用Modern C++(C++17)编写的跨平台、高性能、易用的HTTP/WebSocket框架。基于中间件模式可以方便、高效、优雅的增加功能。cuehttp基于boost.asio开发,使用picohttpparser进行HTTP协议解析。内部依赖了nl

Nov 18, 2022
A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio.

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.

Nov 22, 2022