linux测试lsquic

编译

安装依赖

#不安装zlib make会报错

#不安装 libevent不会报错,但不会生成所需可执行文件

sudo apt-get install cmake zlib1g-dev libevent-dev

boringssl

git clone https://github.com/google/boringssl

cd boringssl

git checkout 0.20250807.0

cmake . && make

export BORINGSSL=$PWD

lsquic

git clone https://github.com/litespeedtech/lsquic

或者git clone https://gitee.com/mirrors/boringssl.git

cd lsquic

git submodule update --init

cmake -DLIBSSL_DIR=$BORINGSSL .

make

#make执行完后确认bin下是否生成http_server和http_client

#测试功能是否正常

make test

证书和dns

签发证书

需要pem格式的证书,pem格式的证书以 -----BEGIN CERTIFICATE----- 开头

可以自己签发,过程略

检查证书有效性:

openssl x509 -in /home/user1/certs/example.pem -text -noout

检查私钥有效性:

openssl rsa -in /home/user1/certs/priv.key -check

确保证书和私钥匹配:

openssl x509 -noout -modulus -in /home/user1/certs/example.pem | openssl md5

openssl rsa -noout -modulus -in /home/user1/certs/priv.key | openssl md5

两者md5值相同

客户端ca证书

把ca证书拷贝到客户端,加载到系统中

客户端hosts配置

把example.com和server的IP映射关系写入/etc/hosts文件

然后重启dns服务

服务端hosts配置

把example.com和0.0.0.0映射关系写入/etc/hosts文件

然后重启dns服务

运行

server

example.com为证书签发的域名

cert.pem是服务端证书

priv.key是相应私钥

监听4443端口

-r指定服务端文件的根目录

-L debug 2打印详细信息

-W

-o base_plpmtu=8900 指定包大小

./http_server -c example.com,/home/user1/cert/cert.pem,/home/user1/cert/priv.key -s 0.0.0.0:4443 -r /home/user1/http3-server/ -L debug 2 -W -o base_plpmtu=8900

client

example.com为server的域名

获取server根目录下的文件index.html

-L debug 2打印详细信息

-T response.txt 将response信息写入指定文件

-K reponse内容不打印到界面上

./http_client -s example.com:4443 -p /index.html -L debug 2 -T response.txt -K

相关推荐
认真的薛薛3 小时前
Linux运维:Jenkins部署
linux·运维·jenkins
o丁二黄o3 小时前
Gemini镜像站办公效能深度解析:多模态链式调用与自动化工作流构建指南
运维·人工智能·自动化
叶半欲缺3 小时前
密码忘记了吗?Linux单用户模式下修改密码!
linux·运维·服务器
handler013 小时前
【Linux 网络】一文读懂 HTTP 协议
linux·c语言·网络·c++·笔记·网络协议·http
铅笔小新z4 小时前
【Linux】进程信号
linux·服务器
晓蓝WQuiet4 小时前
vim/linux使用笔记
linux·笔记·vim
STDD4 小时前
Abiotic Factor多人生存建筑游戏《非生物因素》 专用服务器搭建教程
服务器·数据库·游戏
相思难忘成疾4 小时前
【Linux网络服务】基于Euler系统的主从DNS服务器深度配置
linux·运维·服务器