ngtcp2开源项目

我要开发同款
匿名用户2021年11月30日
106阅读

技术信息

开源地址
https://github.com/apple/GCGC
授权协议
MIT License

作品详情

gtcp2

"CallitTCP/2.OeMoreTime."

gtcp2projectisaefforttoimplemetRFC9000QUICprotocol.

Documetatio

Oliedocumetatioisavailable.

Publictestserver

Thefollowigedpoitsareavailabletotryoutgtcp2implemetatio:

https://ghttp2.org:4433

https://ghttp2.org:4434(requiresaddressvalidatiotoke)

https://ghttp2.org(poweredbyghttpx)

ThisedpoitssedsAlt-SvcheaderfieldtoclietsifitisaccessedviaHTTP/1.1orHTTP/2totellthemthatHTTP/3isavailableatUDP443.

Requiremets

Thelibgtcp2Clibraryitselfdoesotdepedoayexterallibraries.Theexamplecliet,adserverarewritteiC++17,adshouldcompilewiththemoderC++compilers(e.g.,clag>=8.0,orgcc>=8.0).

Thefollowigpackagesarerequiredtocofigurethebuildsystem:

pkg-cofig>=0.20autocofautomakeautotools-devlibtool

libgtcp2usescuitforitsuittestframework:

cuit>=2.1

Tobuildsourcesudertheexamplesdirectory,libevadghttp3arerequired:

libevghttp3forHTTP/3

gtcp2cryptohelperlibrary,adclietadserveruderexamplesdirectoryrequireatleastoeofthefollowigTLSbackeds:

OpeSSLwithQUICsupportGuTLS>=3.7.2BorigSSL(commitf6ef1c560ae5af51e2df5d8d2175bed207b28b8f)Buildfromgit$gitcloe--depth1-bOpeSSL_1_1_1l+quichttps://github.com/quictls/opessl$cdopessl$#ForLiux$./cofigeable-tls1_3--prefix=$PWD/build$make-j$(proc)$makeistall_sw$cd..$gitcloehttps://github.com/gtcp2/ghttp3$cdghttp3$autorecof-i$./cofigure--prefix=$PWD/build--eable-lib-oly$make-j$(proc)check$makeistall$cd..$gitcloehttps://github.com/gtcp2/gtcp2$cdgtcp2$autorecof-i$#ForMacuserswhohaveistalledlibevwithMacPorts,apped$#',-L/opt/local/lib'toLDFLAGS,adalsopass$#CPPFLAGS="-I/opt/local/iclude"to./cofigure.$#ForOpeSSLv3.0.0,replace"opessl/build/lib"with$#"opessl/build/lib64".$./cofigurePKG_CONFIG_PATH=$PWD/../opessl/build/lib/pkgcofig:$PWD/../ghttp3/build/lib/pkgcofigLDFLAGS="-Wl,-rpath,$PWD/../opessl/build/lib"$make-j$(proc)checkCliet/Server

Aftersuccessfulbuild,theclietadserverexecutableshouldbefoududerexamplesdirectory.TheytalkHTTP/3.

Cliet$examples/cliet[OPTIONS]<HOST><PORT>[<URI>...]

Theotableoptiosare:

-d,--data=<PATH>:Readdatafrom<PATH>adsedittoapeer.Server$examples/server[OPTIONS]<ADDR><PORT><PRIVATE_KEY_FILE><CERTIFICATE_FILE>

Theotableoptiosare:

-V,--validate-addr:Eforcestatelessaddressvalidatio.H09cliet/H09server

Thereareh09clietadh09serverwhichspeakHTTP/0.9.Theyarewrittejustforquic-iterop-ruer.TheysharethebasicfuctioalitieswithHTTP/3clietadserverbuthavelessfuctios(e.g.,h09clietdoesothaveacapabilitytosedrequestbody,adh09serverdoesotuderstadumericrequestpath,like/1000).

Resumptioad0-RTT

Iordertoresumeasessio,asessioticket,adatrasportparametersmustbefetchedfromserver.First,ruexamples/clietwith--sessio-file,ad--tp-fileoptioswhichspecifyapathtosessioticket,adtrasportparameterfilesrespectivelytosavethemlocally.

Ocethesefilesareavailable,ruexamples/clietwiththesameargumetsagai.Youwillseethatsessioisresumediyourlogifresumptiosucceeds.Resumigsessiomakesserver'sfirstHadshakepacketprettysmallbecauseitdoesotseditscertificates.

Tosed0-RTTdata,aftermakigsurethatresumptioworks,use-doptiotospecifyafilewhichcotaisdatatosed.

Toke(NotsomethigicludediRetrypacket)

QUICservermightsedatoketoclietaftercoectiohasbeeestablished.Clietcasedthistokeisubsequetcoectiototheserver.Serververifiesthetokeadifitsucceeds,theaddressvalidatiocompletesadliftssomerestrictiososerverwhichmightspeeduptrasfer.Iordertosavead/orloadatoke,use--toke-fileoptioofexamples/cliet.Thegivefileisoverwritteifitalreadyexistswhestorigatoke.

Cryptohelperlibrary

IordertomakeTLSstackitegratiolesspaiful,weprovideacryptohelperlibrarywhichoffersthebasiccryptooperatios.

Theheaderfileexistsudercrypto/icludes/gtcp2directory.

EachlibraryfileisbuiltforaparticularTLSbacked.Theavailablecryptohelperlibrariesare:

libgtcp2_crypto_opessl:UseOpeSSLasTLSbackedlibgtcp2_crypto_gutls:UseGuTLSasTLSbackedlibgtcp2_crypto_borigssl:UseBorigSSLasTLSbacked

BecauseBorigSSLisauversioedproduct,weolytesteditsparticularrevisio.SeeRequiremetssectioabove.

TheexamplesdirectorycotaisclietadserverthatarelikedtothosecryptohelperlibrariesadTLSbackeds.Theyareolybuiltiftheircorrespodigcryptohelperlibraryisbuilt:

cliet:OpeSSLclietserver:OpeSSLservergtlscliet:GuTLSclietgtlsserver:GuTLSserverbsslcliet:BorigSSLclietbsslserver:BorigSSLserverQUICprotocolextesios

ThelibraryimplemetsthefollowigQUICprotocolextesios:

AUreliableDatagramExtesiotoQUICGreasigtheQUICBitCofigurigWiresharkforQUIC

WiresharkcabecofiguredtoaalyzeQUICtrafficusigthefollowigsteps:

SetSSLKEYLOGFILEevirometvariable:

$exportSSLKEYLOGFILE=quic_keylog_file

SettheportthatQUICuses

GotoPrefereces->Protocols->QUICadsettheporttheprogramlistesto.Ithecaseoftheexampleapplicatiothiswouldbetheportspecifiedothecommadlie.

SetPre-Master-Secretlogfile

GotoPrefereces->Protocols->TLSaddsetthePre-Master-SecretlogfiletothesamevaluethatwasspecifiedforSSLKEYLOGFILE.

Choosethecorrectetworkiterfaceforcapturig

Makesureyouchoosethecorrectetworkiterfaceforcapturig.Forexample,ifusiglocalhostchoosetheloopbacketworkiterfaceomacos.

Createafilter

CreateAfilterfortheudp.portadsettheporttotheporttheapplicatioislisteigto.Forexample:

udp.port==7777Licese

TheMITLicese

Copyright(c)2016gtcp2cotributors

功能介绍

ngtcp2 "Call it TCP/2. One More Time." ngtcp2 project is an effort to implement RFC9000 QUIC prot...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论