{"id":16866947,"url":"https://github.com/dtikhonov/lsquic-tutorial","last_synced_at":"2025-04-11T10:16:00.073Z","repository":{"id":52190402,"uuid":"240286920","full_name":"dtikhonov/lsquic-tutorial","owner":"dtikhonov","description":"lsquic tutorial teaches one how to build an application using lsquic, an open-source QUIC and HTTP/3 library","archived":false,"fork":false,"pushed_at":"2020-09-08T19:56:21.000Z","size":217,"stargazers_count":29,"open_issues_count":1,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T07:02:49.677Z","etag":null,"topics":["http3","lsquic","netdev","qpack","quic"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dtikhonov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-13T14:59:16.000Z","updated_at":"2025-01-14T11:41:57.000Z","dependencies_parsed_at":"2022-08-03T12:30:50.941Z","dependency_job_id":null,"html_url":"https://github.com/dtikhonov/lsquic-tutorial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtikhonov%2Flsquic-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtikhonov%2Flsquic-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtikhonov%2Flsquic-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtikhonov%2Flsquic-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dtikhonov","download_url":"https://codeload.github.com/dtikhonov/lsquic-tutorial/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248373089,"owners_count":21093138,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http3","lsquic","netdev","qpack","quic"],"created_at":"2024-10-13T14:52:13.521Z","updated_at":"2025-04-11T10:16:00.040Z","avatar_url":"https://github.com/dtikhonov.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/dtikhonov/lsquic-tutorial.svg?branch=master)](https://travis-ci.org/dtikhonov/lsquic-tutorial)\n\n# lsquic-tutorial\nlsquic tutorial teaches one how to build an application using [lsquic](https://github.com/litespeedtech/lsquic).\n\n## Description\nThe tutorial program, tut.c, contains client and server logic for a simple echo program.\nThe client connects to the server and sends lines of text; the server reverses the lines of text and sends them back.\n\nThe tutorial program was written as an educational aid.  Various aspects of the ways LSQUIC\nis used in it are considered in [Netdev 0x14 slides](https://github.com/dtikhonov/talks/blob/master/netdev-0x14/lsquic-slides.md).\nIn addition to the slides, please refer to the [LSQUIC API Reference](https://lsquic.readthedocs.io/en/latest/apiref.html).\n\ntut.c contains several versions of reading and writing from stream to illustrate different ways of\nusing the library.  There are also two ways to send packets.\n\n## Building\nTo build the tutorial:\n```bash\ngit submodule update --init --recursive\ncmake .\nmake\n```\n\nThis clones and builds BoringSSL, so it may take a few minutes.\n\n## Usage\n\n### All options\n```bash\nsh$ ./tut -h\nUsage: tut [-c cert -k key] [options] IP port\n\n   -c cert.file    Certificate.\n   -k key.file     Key file.\n   -f log.file     Log message to this log file.  If not specified, the\n                     are printed to stderr.\n   -L level        Set library-wide log level.  Defaults to 'warn'.\n   -l module=level Set log level of specific module.  Several of these\n                     can be specified via multiple -l flags or by combining\n                     these with comma, e.g. -l event=debug,conn=info.\n   -v              Verbose: log program messages as well.\n   -b VERSION      Use callbacks version VERSION.\n   -p VERSION      Use packets_out version VERSION.\n   -w VERSION      Use server write callback version VERSION.\n   -o opt=val      Set lsquic engine setting to some value, overriding the\n                     defaults.  For example,\n                           -o version=ff00001c -o cc_algo=2\n   -G DIR          Log TLS secrets to a file in directory DIR.\n   -h              Print this help screen and exit.\n```\n\n### Running the server\nBoth client and server logic are contained in the `tut` program.  It knows it is meant to run in the server\nmode when `-c` and `-k` options are specified:\n\n```bash\nsh$ ./tut -c mycert-cert.pem -k mycert-key.pem ::0 12345 -p 1 -L debug -f server.log\n```\n\nThe server can select one of two versions of \"on stream write\" callbacks.  Use `-w` command-line option for that.\n\n### Running the client\n```bash\nsh$ ./tut ::1 12345 -L debug -f client.log\nHello!\n!olleH\n^D\nsh$\n```\n\nThe server can select one of three versions of \"on stream read\" callbacks.  Use `-b` command-line option for that.\n\nBoth client and server can use the `-p` option to select one of two \"send packets out\" callbacks.\n\n## HTTP/3 Client\nAs a bonus, a simple [HTTP/3](https://en.wikipedia.org/wiki/HTTP/3) client is provided.  Example:\n\n```bash\nsh$ ./h3cli -M HEAD www.litespeedtech.com 443 /\nHTTP/1.1 200 OK\nx-powered-by: PHP/7.3.5\nx-logged-in: False\nx-content-powered-by: K2 v2.7.1 (by JoomlaWorks)\ncontent-type: text/html; charset=utf-8\nexpires: Wed, 17 Aug 2005 00:00:00 GMT\nlast-modified: Wed, 12 Aug 2020 18:54:05 GMT\ncache-control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0\npragma: no-cache\netag: \"23485-1597258445;gz\"\nvary: Accept-Encoding\nx-frame-options: SAMEORIGIN\nx-lsadc-cache: hit\ndate: Thu, 13 Aug 2020 02:48:06 GMT\nserver: LiteSpeed\n```\n\nBesides www.litespeedtech.com, other websites to try are www.facebook.com and www.google.com.\n\n## More Information\nLatest QUIC and HTTP/3 GitHub artefacts can be found [here](https://github.com/quicwg/base-drafts).\nThe QUIC IETF Working Group materials are [here](https://datatracker.ietf.org/wg/quic/about/).\n\nThe [LSQUIC GitHub Repo](https://github.com/litespeedtech/lsquic) contains several more advanced examples, among\nthem HTTP/3 client and server programs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtikhonov%2Flsquic-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtikhonov%2Flsquic-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtikhonov%2Flsquic-tutorial/lists"}