GithubHelp home page GithubHelp logo

quiche's Introduction

quiche

quiche is a work-in-progress QUIC implementation by BVC (Bilibili Video Cloud team). It is based on Google quiche(https://quiche.googlesource.com/quiche/). BVC uses this to enable gQUIC and iQUIC service capability on production, for example, there are quic proxy server and nginx quic module.

QUIC (Quick UDP Internet Connections) is a new transport which reduces latency compared to that of TCP. Look QUIC from 10000 feet, it is very similar to TCP+TLS+HTTP/2 implemented on UDP. Because TCP is implemented in operating system kernels, and middlebox firmware, making significant changes to TCP is next to impossible. However, since QUIC is built on top of UDP, it suffers from no such limitations.

Key features of QUIC+HTTP3 over existing TCP+TLS+HTTP2 include

  • User space implementation
  • Dramatically reduced connection establishment time
  • Improved congestion control
  • Multiplexing without head of line blocking
  • Connection migration

Google quiche is used in Chromium (http://www.chromium.org/quic) project. This repository integrates google quiche with some common-used repositories, which are independent of Chromium platform.

  • Platform related implementations of epoll server/client, http2 stack, quic stack
  • Rewrite include directives for google quiche source files

Features

  • Easy building with cmake
  • Only support Linux platform
  • Easy to keep pace with Google quiche upgrading
  • Support Qlog: APIs to expose transport and server statistics for debuggability with qvis

Source Layout

  • base: Implementation of basic platform functions
  • googleurl: Googleurl source files
  • gquiche: Google quiche source files
  • net: Implementation of platform net related functions
  • platform/epoll_platform_impl: Implementation of epoll client and server functions
  • platform/http2_platform_impl: Implementation of http2 stack functions
  • platform/quic_platform_impl: Implementation of quic stack functions
  • platform/quiche_platform_impl: Implementation of google quiche platform functions
  • platform/spdy_platform_impl: Implementation of spdy stack functions
  • third_party: Submodules of thirdparty repositories
  • utils: Scripts of some usefull utilities

Getting Started

Prerequisite

apt-get install cmake build-essential protobuf-compiler libprotobuf-dev golang-go libunwind-dev libicu-dev
git submodule update --init

Build

mkdir build && cd build  
cmake .. && make
cd -
extra cmake options values default
ENABLE_LINK_TCMALLOC on, off on

Play examples

  • A sample quic server and client implementation are provided in quiche. To use these you should build the binaries.
cd build
make simple_quic_server simple_quic_client
cd -
  • Download a copy of www.example.org, which we will serve locally using the simple_quic_server binary.
mkdir -p /data/quic-root
wget -p --save-headers https://www.example.org -P /data/quic-root
  • In order to run the simple_quic_server, you will need a valid certificate, and a private key is pkcs8 format. If you don't have one, there are scripts to generate them.
cd utils
./generate-certs.sh
mkdir -p /data/quic-cert
mv ./out/* /data/quic-cert/
cd -
  • Run the quic server
./build/simple_quic_server \
  --quic_response_cache_dir=/data/quic-root/ \
  --certificate_file=/data/quic-cert/leaf_cert.pem \
  --key_file=/data/quic-cert/leaf_cert.pkcs8
  • Request the file with quic client
./build/simple_quic_client \
  --disable_certificate_verification=true \
  --host=127.0.0.1 --port=6121 \
  "https://www.example.org/index.html"

You can also use chormium-based browsers to access simple_quic_server at 127.0.0.1:6121, and check the request/response protocol by DevTools -> Network panel.

quiche's People

Contributors

crazycw avatar kuroa-me avatar macrolau avatar tonybase avatar wangsheng-bilibili avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quiche's Issues

google_quiche_rewrite.sh isn't sufficient to build latest google quiche repo code

In Development.md
cp -fr google_quiche/* gquiche/ && cd gquiche && bash utils/google_quiche_rewrite.sh

google_quiche_rewrite.sh isn't sufficient to build latest google quiche repo code.

  1. Have to create a CMakeLists.txt in quic/core/proto
    Replace:

include "net/gquiche/quic/platform/impl/
with: include "platform/quic_platform_impl/quic_reference_counted_impl/
3.
include "net/tools/gquiche/epoll_server/platform/impl/
with: include "platform/epoll_platform_impl/
4.
Change definitions for error: macro "QUIC_PROTOCOL_FLAG" passed 5 arguments, but takes just 4

etc.

Does anyone have an updated google_quiche_rewrite.sh

系统已经配置tcmalloc_minimal4库,但是项目编译仍然找不到。

编译时遇到的错误:
[ 27%] Built target fipsmodule
[ 55%] Built target crypto
[ 59%] Built target ssl
[ 98%] Built target quiche
[ 98%] Linking CXX executable simple_quic_server
/usr/bin/ld: cannot find -ltcmalloc_minimal: No such file or directory
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/simple_quic_server.dir/build.make:327: simple_quic_server] Error 1
make[2]: *** [CMakeFiles/Makefile2:1100: CMakeFiles/simple_quic_server.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:1107: CMakeFiles/simple_quic_server.dir/rule] Error 2
make: *** [Makefile:195: simple_quic_server] Error 2

执行ldconfig -p命令可以找到该库:

myk@MSN-Desktop-myk:~/Project/quiche/build$ ldconfig -p | grep tcmalloc
libtcmalloc_minimal_debug.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libtcmalloc_minimal_debug.so.4
libtcmalloc_minimal.so.4 (libc6,x86-64) => /usr/local/lib/libtcmalloc_minimal.so.4
libtcmalloc_minimal.so.4 (libc6,x86-64) => /lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4
libtcmalloc_minimal.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libtcmalloc_minimal.so

另外编译test.c也可以找到这个库:
myk@MSN-Desktop-myk:/Project/quiche/build$ g++ test.c -ltcmalloc_minimal
myk@MSN-Desktop-myk:
/Project/quiche/build$

跟随chromium tag升级

你好,请问你们是怎么执行升级动作的呢?【Easy to keep pace with Google quiche upgrading】
另外这个工程能用来构建出so给Android 工程使用吗?

link libtcmalloc fail

hi I fell into trouble when I execute the command to build demo server:

make simple_quic_server simple_quic_client 

at last failed and the log is:

[ 97%] Linking CXX executable simple_quic_server
/usr/bin/ld: cannot find -ltcmalloc_minimal
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/simple_quic_server.dir/build.make:283: simple_quic_server] Error 1
make[2]: *** [CMakeFiles/Makefile2:965: CMakeFiles/simple_quic_server.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:972: CMakeFiles/simple_quic_server.dir/rule] Error 2
make: *** [Makefile:131: simple_quic_server] Error 2

I have install tcmalloc:

sudo apt-get install -y libtcmalloc-minimal4

my system info is:

ubuntu@ubuntu:~/quiche/build$ !181
lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.3 LTS
Release:	20.04
Codename:	focal

没有任何修改,运行simple_quic_server出现segmentation fault

编译完成之后按照README.md执行simple_quic_server时出现段错误。
环境:
Linux MSN-Desktop-myk 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

尝试过切换多个tag版本的代码,均有这个问题。

以下是简单的log(执行simle_quic_server时候没有加选项,但是不影响结果)。

编译:

myk@MSN-Desktop-myk:~/Project/quiche/build$ make simple_quic_server
[  3%] Built target gurl
[  5%] Built target fmt
[  5%] Built target absl_log_severity
[  6%] Built target absl_raw_logging_internal
[  6%] Built target absl_spinlock_wait
[  6%] Built target absl_base
[  6%] Built target absl_malloc_internal
[  6%] Built target absl_throw_delegate
[  6%] Built target absl_strerror
[  7%] Built target absl_time_zone
[  7%] Built target absl_debugging_internal
[  7%] Built target absl_stacktrace
[  7%] Built target absl_strings_internal
[  7%] Built target absl_demangle_internal
[  7%] Built target absl_int128
[ 10%] Built target absl_strings
[ 10%] Built target absl_symbolize
[ 11%] Built target absl_exponential_biased
[ 11%] Built target absl_graphcycles_internal
[ 12%] Built target absl_civil_time
[ 13%] Built target absl_time
[ 15%] Built target absl_synchronization
[ 16%] Built target absl_hashtablez_sampler
[ 17%] Built target absl_bad_optional_access
[ 17%] Built target absl_raw_hash_set
[ 18%] Built target absl_flags_program_name
[ 20%] Built target absl_flags_config
[ 20%] Built target absl_str_format_internal
[ 20%] Built target absl_flags_marshalling
[ 20%] Built target absl_flags_commandlineflag_internal
[ 20%] Built target absl_flags_commandlineflag
[ 20%] Built target absl_flags_private_handle_accessor
[ 20%] Built target absl_bad_variant_access
[ 20%] Built target absl_city
[ 21%] Built target absl_low_level_hash
[ 21%] Built target absl_hash
[ 22%] Built target absl_cord_internal
[ 22%] Built target absl_cordz_functions
[ 22%] Built target absl_cordz_handle
[ 22%] Built target absl_cordz_info
[ 22%] Built target absl_cord
[ 22%] Built target absl_flags_reflection
[ 22%] Built target absl_flags_internal
[ 22%] Built target absl_flags
[ 22%] Built target absl_flags_usage_internal
[ 22%] Built target absl_flags_usage
[ 22%] Built target absl_flags_parse
[ 22%] Built target absl_status
[ 24%] Built target absl_statusor
[ 24%] Built target global_target
[ 27%] Built target fipsmodule
[ 55%] Built target crypto
[ 59%] Built target ssl
[ 98%] Built target quiche
Consolidate compiler generated dependencies of target simple_quic_server
[ 98%] Building CXX object CMakeFiles/simple_quic_server.dir/gquiche/quic/tools/quic_server_bin.cc.o
[ 98%] Building CXX object CMakeFiles/simple_quic_server.dir/gquiche/quic/tools/quic_toy_server.cc.o
[ 98%] Linking CXX executable simple_quic_server
[100%] Built target simple_quic_server
myk@MSN-Desktop-myk:~/Project/quiche/build$ ls
CMakeCache.txt  Makefile  cmake_install.cmake  gquiche      simple_quic_client  test.c
CMakeFiles      a.out     googleurl            libquiche.a  simple_quic_server  third_party
myk@MSN-Desktop-myk:~/Project/quiche/build$

执行:

myk@MSN-Desktop-myk:~/Project/quiche/build$ ./simple_quic_server
Segmentation fault
myk@MSN-Desktop-myk:~/Project/quiche/build$

How to debug the `simple_quic_server`

When I run the demo execute binary of quiche :simple_quic_server. After that I use gdb to debug the server

gdb simple_quic_server --pid=9708

but there are something wrong with the gdb command: list.It could not list all source code

(gdb) s
Single stepping until exit from function _ZN4quic10QuicServer19HandleEventsForeverEv,
which has no line number information.

and I find that CMAKE_CXX_FLAGS_DEBUG is '-O0 -Wall -g2 -ggdb' . It should list all the code when debug by GDB.

Thank U for your reply

同步谷歌官方最新代码

可以同步谷歌官方最新代码以便支持最新的功能,如支持IETF v2[RFC 9369],版本协商[RFC 9368]等等

ubuntu16.04编译失败,"error: function 'base::FilePath& base::FilePath::operator=(base::FilePath&&)' defaulted on its redeclaration with an exception-specification that differs from the implicit exception-specification '

编译环境: Release: 16.04
cmake: 3.20.4
commit: 21b1a63
Merge: ce67509 d37d224
Author: wang_and_sheng [email protected]
Date: Mon May 24 13:51:23 2021 +0800

Merge pull request #1 from incfex/main

Update README.md

编译出错信息
[ 51%] Built target ssl
[ 51%] Building CXX object CMakeFiles/quiche.dir/base/files/file_path.cc.o
/home/quiche/base/files/file_path.cc:53:11: error: function 'base::FilePath& base::FilePath::operator=(base::FilePath&&)' defaulted on its redeclaration with an exception-specification that differs from the implicit exception-specification ''
FilePath& FilePath::operator=(FilePath&& that) noexcept = default;
^
CMakeFiles/quiche.dir/build.make:75: recipe for target 'CMakeFiles/quiche.dir/base/files/file_path.cc.o' failed
make[2]: *** [CMakeFiles/quiche.dir/base/files/file_path.cc.o] Error 1
CMakeFiles/Makefile2:813: recipe for target 'CMakeFiles/quiche.dir/all' failed

libquiche.a库文件太大

这个代码不是精简了吗?为什么库文件还这么大,172M,这么大怎么安装在客户端?

如何处理客户端ip和端口变化

1.客户端网络发生变化,重建连接,在LB上根据connection ID做路由,保证转发到相同的实例上,LB如果是Nginx,是否也要修改Nginx?
2.这个仓库是一个单进程的实例,对于生产环境,也是要做一些修改?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.