gtcp2
"CallitTCP/2.OeMoreTime."
gtcp2projectisaefforttoimplemetRFC9000QUICprotocol.
DocumetatioOliedocumetatioisavailable.
PublictestserverThefollowigedpoitsareavailabletotryoutgtcp2implemetatio:
https://ghttp2.org:4433
https://ghttp2.org:4434(requiresaddressvalidatiotoke)
https://ghttp2.org(poweredbyghttpx)
ThisedpoitssedsAlt-SvcheaderfieldtoclietsifitisaccessedviaHTTP/1.1orHTTP/2totellthemthatHTTP/3isavailableatUDP443.
RequiremetsThelibgtcp2Clibraryitselfdoesotdepedoayexterallibraries.Theexamplecliet,adserverarewritteiC++17,adshouldcompilewiththemoderC++compilers(e.g.,clag>=8.0,orgcc>=8.0).
Thefollowigpackagesarerequiredtocofigurethebuildsystem:
pkg-cofig>=0.20autocofautomakeautotools-devlibtoollibgtcp2usescuitforitsuittestframework:
cuit>=2.1Tobuildsourcesudertheexamplesdirectory,libevadghttp3arerequired:
libevghttp3forHTTP/3gtcp2cryptohelperlibrary,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/ServerAftersuccessfulbuild,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/H09serverThereareh09clietadh09serverwhichspeakHTTP/0.9.Theyarewrittejustforquic-iterop-ruer.TheysharethebasicfuctioalitieswithHTTP/3clietadserverbuthavelessfuctios(e.g.,h09clietdoesothaveacapabilitytosedrequestbody,adh09serverdoesotuderstadumericrequestpath,like/1000).
Resumptioad0-RTTIordertoresumeasessio,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.
CryptohelperlibraryIordertomakeTLSstackitegratiolesspaiful,weprovideacryptohelperlibrarywhichoffersthebasiccryptooperatios.
Theheaderfileexistsudercrypto/icludes/gtcp2directory.
EachlibraryfileisbuiltforaparticularTLSbacked.Theavailablecryptohelperlibrariesare:
libgtcp2_crypto_opessl:UseOpeSSLasTLSbackedlibgtcp2_crypto_gutls:UseGuTLSasTLSbackedlibgtcp2_crypto_borigssl:UseBorigSSLasTLSbackedBecauseBorigSSLisauversioedproduct,weolytesteditsparticularrevisio.SeeRequiremetssectioabove.
TheexamplesdirectorycotaisclietadserverthatarelikedtothosecryptohelperlibrariesadTLSbackeds.Theyareolybuiltiftheircorrespodigcryptohelperlibraryisbuilt:
cliet:OpeSSLclietserver:OpeSSLservergtlscliet:GuTLSclietgtlsserver:GuTLSserverbsslcliet:BorigSSLclietbsslserver:BorigSSLserverQUICprotocolextesiosThelibraryimplemetsthefollowigQUICprotocolextesios:
AUreliableDatagramExtesiotoQUICGreasigtheQUICBitCofigurigWiresharkforQUICWiresharkcabecofiguredtoaalyzeQUICtrafficusigthefollowigsteps:
SetSSLKEYLOGFILEevirometvariable:
$exportSSLKEYLOGFILE=quic_keylog_fileSettheportthatQUICuses
GotoPrefereces->Protocols->QUICadsettheporttheprogramlistesto.Ithecaseoftheexampleapplicatiothiswouldbetheportspecifiedothecommadlie.
SetPre-Master-Secretlogfile
GotoPrefereces->Protocols->TLSaddsetthePre-Master-SecretlogfiletothesamevaluethatwasspecifiedforSSLKEYLOGFILE.
Choosethecorrectetworkiterfaceforcapturig
Makesureyouchoosethecorrectetworkiterfaceforcapturig.Forexample,ifusiglocalhostchoosetheloopbacketworkiterfaceomacos.
Createafilter
CreateAfilterfortheudp.portadsettheporttotheporttheapplicatioislisteigto.Forexample:
udp.port==7777LiceseTheMITLicese
Copyright(c)2016gtcp2cotributors
评论