文档说明:只记录关键地方;
试验环境: linux debian 11
目标:构建能测试的quic server
下载chromium 并且安装好依赖以后,执行脚本
#!/bin/bash
set -exu
__CURRENT__=`pwd`
__DIR__=$(cd "$(dirname "$0")";pwd)
cd ${__DIR__}
cd ${__DIR__}/chromium/chromium/src/
test -d out/Default && rm -rf out/Default
gn gen out/Default --args='is_debug=false symbol_level=0 enable_nacl=false blink_symbol_level=0 is_component_build=false use_debug_fission=false is_clang=false'
ninja -j $(nproc) -C out/Default quic_server quic_client
ldd out/Default/quic_server
nginx 配置添加如下参数,为了使用http3 quic协议 (由http2 over tcp 跳转到http3 over udp )
set $alt_svc 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"';
add_header "Alt-Svc" $alt_svc; # Advertise that HTTP/3 is available
使用quic_server
cd out/Default/quic_server
des=/quic_workspace
cp libnet.so $des
cp libbase.so $des
cp libboringssl.so $des
cp libabsl.so $des
cp liburl.so $des
cp libc++.so $des
cp libprotobuf_lite.so $des
cp libperfetto.so $des
cp libcrcrypto.so $des
cp libchrome_zlib.so $des
cp libbase_i18n.so $des
cp libicui18n.so $des
cp libicuuc.so $des
cp quic_server $des
openssl pkcs8 \
-topk8 \
-outform DER \
-inform PEM \
-in /tls/wildcard.domain.fullchain.pem \
-out /tls/wildcard.domain.pkcs8 \
-nocrypt
/quic_workspace/quic_server
--quic_response_cache_dir=/data
--certificate_file=/tls/wildcard.domain.fullchain.pem
--key_file=/tls/wildcard.domain.pkcs8
--enable_webtransport=true
--generate_dynamic_responses=true
--port=443
--quic_mode=proxy
--quic_proxy_backend_url=https://you-domain
--host=0.0.0.0
--v=1
参考文档
- QUIC, a multiplexed transport over UDP
- quic generate-certs
- quic 使用
- http3验证
- 定制自己的chromium浏览器,linux版
- 快速下载chromium源码