README.md revision 1fc8f998
11fc8f998SDmitri Tikhonov[![Build Status](https://travis-ci.org/dtikhonov/lsquic-client.svg?branch=master)](https://travis-ci.org/dtikhonov/lsquic-client)
21fc8f998SDmitri Tikhonov
350aadb33SDmitri TikhonovLiteSpeed QUIC (LSQUIC) Client Library README
450aadb33SDmitri Tikhonov=============================================
550aadb33SDmitri Tikhonov
650aadb33SDmitri TikhonovDescription
750aadb33SDmitri Tikhonov-----------
850aadb33SDmitri Tikhonov
950aadb33SDmitri TikhonovLiteSpeed QUIC (LSQUIC) Client Library is an open-source implementation
1050aadb33SDmitri Tikhonovof QUIC functionality for clients.  It is released in the hope to speed
1150aadb33SDmitri Tikhonovthe adoption of QUIC.  Most of the code in this distribution is used in
1250aadb33SDmitri Tikhonovour own products: LiteSpeed Web Server and ADC.  We think it is free of
1350aadb33SDmitri Tikhonovmajor problems.  Nevertheless, do not hesitate to report bugs back to us.
1450aadb33SDmitri TikhonovEven better, send us fixes and improvements!
1550aadb33SDmitri Tikhonov
161b97e4afSDmitri TikhonovCurrently supported QUIC versions are Q035, Q037, Q038, Q039, and Q041.
1750aadb33SDmitri TikhonovSupport for newer versions will be added soon after they are released.
1850aadb33SDmitri TikhonovThe version(s) specified by IETF QUIC WG will be added once the IETF
1950aadb33SDmitri Tikhonovversion of the protocol settles down a little.
2050aadb33SDmitri Tikhonov
2150aadb33SDmitri TikhonovDocumentation
2250aadb33SDmitri Tikhonov-------------
2350aadb33SDmitri Tikhonov
2450aadb33SDmitri TikhonovThe documentation for this module is admittedly sparse.  The API is
2550aadb33SDmitri Tikhonovdocumented in include/lsquic.h.  If you have doxygen, you can run
26e0197994SDmitri Tikhonov`doxygen dox.cfg` or `make docs`.  The example program is
2750aadb33SDmitri Tikhonovtest/http_client.c: a bare-bones, but working, QUIC client.  Have a look
2850aadb33SDmitri Tikhonovin EXAMPLES.txt to see how it can be used.
2950aadb33SDmitri Tikhonov
30e0197994SDmitri TikhonovRequirements
31e0197994SDmitri Tikhonov------------
3250aadb33SDmitri Tikhonov
33e0197994SDmitri TikhonovTo build LSQUIC, you need CMake, zlib, and BoringSSL.  The example program
34e0197994SDmitri Tikhonovuses libevent to provide the event loop.
3550aadb33SDmitri Tikhonov
36e0197994SDmitri TikhonovBuilding BoringSSL
37e0197994SDmitri Tikhonov------------------
38e0197994SDmitri Tikhonov
39e0197994SDmitri TikhonovBoringSSL is not packaged; you have to build it yourself.  The process is
40e0197994SDmitri Tikhonovstraightforward.  You will need `go` installed.
41e0197994SDmitri Tikhonov
42e0197994SDmitri Tikhonov1. Clone BoringSSL by issuing the following command:
43e0197994SDmitri Tikhonov
44e0197994SDmitri Tikhonov```
45e0197994SDmitri Tikhonovgit clone https://boringssl.googlesource.com/boringssl
46e0197994SDmitri Tikhonovcd boringssl
47e0197994SDmitri Tikhonov```
48e0197994SDmitri Tikhonov
49e0197994SDmitri Tikhonov2. Check out stable branch:
50e0197994SDmitri Tikhonov
51e0197994SDmitri Tikhonov```
5267b0dc15SDmitri Tikhonovgit checkout chromium-stable
53e0197994SDmitri Tikhonov```
54e0197994SDmitri Tikhonov
55e0197994SDmitri Tikhonov3. Compile the library
56e0197994SDmitri Tikhonov
57e0197994SDmitri Tikhonov```
58e0197994SDmitri Tikhonovcmake . &&  make
59e0197994SDmitri Tikhonov```
60e0197994SDmitri Tikhonov
61e0197994SDmitri TikhonovIf you want to turn on optimizations, do
62e0197994SDmitri Tikhonov
63e0197994SDmitri Tikhonov```
64e0197994SDmitri Tikhonovcmake -DCMAKE_BUILD_TYPE=Release . && make
65e0197994SDmitri Tikhonov```
66e0197994SDmitri Tikhonov
67e0197994SDmitri Tikhonov4. Install the library
68e0197994SDmitri Tikhonov
69e0197994SDmitri TikhonovThis is the manual step.  You will need to copy library files manually.
70e0197994SDmitri TikhonovLSQUIC client library needs two: `ssl/libssl.a` and `crypto/libcrypto.a`.
71e0197994SDmitri TikhonovTo install these in `/usr/local/lib`, you should do the following:
72e0197994SDmitri Tikhonov
73e0197994SDmitri Tikhonov```
74e0197994SDmitri TikhonovBORINGSSL_SOURCE=$PWD
75e0197994SDmitri Tikhonovcd /usr/local/lib
7667b0dc15SDmitri Tikhonovsudo cp $BORINGSSL_SOURCE/ssl/libssl.a .
7767b0dc15SDmitri Tikhonovsudo cp $BORINGSSL_SOURCE/crypto/libcrypto.a .
78e0197994SDmitri Tikhonov```
79e0197994SDmitri Tikhonov
80e0197994SDmitri TikhonovIf you do not want to install the library (or do not have root), you
81e0197994SDmitri Tikhonovcan do this instead:
82e0197994SDmitri Tikhonov
83e0197994SDmitri Tikhonov```
84e0197994SDmitri TikhonovBORINGSSL_SOURCE=$PWD
85e0197994SDmitri Tikhonovmkdir -p $HOME/tmp/boringssl-libs
86e0197994SDmitri Tikhonovcd $HOME/tmp/boringssl-libs
87e0197994SDmitri Tikhonovln -s $BORINGSSL_SOURCE/ssl/libssl.a
88e0197994SDmitri Tikhonovln -s $BORINGSSL_SOURCE/crypto/libcrypto.a
89e0197994SDmitri Tikhonov```
90e0197994SDmitri Tikhonov
91e0197994SDmitri TikhonovBuilding LSQUIC Client Library
92e0197994SDmitri Tikhonov------------------------------
93e0197994SDmitri Tikhonov
94e0197994SDmitri TikhonovLSQUIC's `http_client` and the tests link BoringSSL libraries statically.
95e0197994SDmitri TikhonovFollowing previous section, you can build LSQUIC as follows:
96e0197994SDmitri Tikhonov
9767b0dc15SDmitri Tikhonov1. Get the source code
9867b0dc15SDmitri Tikhonov
9967b0dc15SDmitri Tikhonov```
10067b0dc15SDmitri Tikhonovgit clone https://github.com/litespeedtech/lsquic-client.git
10167b0dc15SDmitri Tikhonovcd lsquic-client
10267b0dc15SDmitri Tikhonov```
10367b0dc15SDmitri Tikhonov
10467b0dc15SDmitri Tikhonov2. Compile the library
10567b0dc15SDmitri Tikhonov
10667b0dc15SDmitri Tikhonov
107e0197994SDmitri Tikhonov```
108e0197994SDmitri Tikhonovcmake -DBORINGSSL_INCLUDE=$BORINGSSL_SOURCE/include \
109e0197994SDmitri Tikhonov                                -DBORINGSSL_LIB=$HOME/tmp/boringssl-libs .
110e0197994SDmitri Tikhonovmake
111e0197994SDmitri Tikhonov```
112e0197994SDmitri Tikhonov
11367b0dc15SDmitri Tikhonov3. Run tests
114e0197994SDmitri Tikhonov
115e0197994SDmitri Tikhonov```
116e0197994SDmitri Tikhonovmake test
117e0197994SDmitri Tikhonov```
118e0197994SDmitri Tikhonov
119306ecefeSBrian ProdoehlBuilding with Docker
120306ecefeSBrian Prodoehl---------
121306ecefeSBrian ProdoehlThe library and http_client example can be built with Docker.
122306ecefeSBrian Prodoehl```
123306ecefeSBrian Prodoehldocker build -t lsquic-client .
124306ecefeSBrian Prodoehl```
125306ecefeSBrian Prodoehl
126306ecefeSBrian ProdoehlThen you can use the http_client example from the command line.
127306ecefeSBrian Prodoehl```
128306ecefeSBrian Prodoehldocker run -it --rm lsquic-client http_client -H www.google.com -s 74.125.22.106:443 -p /
129306ecefeSBrian Prodoehl```
130306ecefeSBrian Prodoehl
131e0197994SDmitri TikhonovPlatforms
132e0197994SDmitri Tikhonov---------
133e0197994SDmitri Tikhonov
134e0197994SDmitri TikhonovThe client library has been tested on the following platforms:
135e0197994SDmitri Tikhonov- Linux
136e0197994SDmitri Tikhonov  - x86_64
137e0197994SDmitri Tikhonov  - ARM (Raspberry Pi 3)
138e0197994SDmitri Tikhonov- FreeBSD
139e0197994SDmitri Tikhonov  - i386
140da710addSDmitri Tikhonov- Windows
141da710addSDmitri Tikhonov  - x86_64
142e0197994SDmitri Tikhonov- MacOS
143e0197994SDmitri Tikhonov  - x86_64
14450aadb33SDmitri Tikhonov
14550aadb33SDmitri TikhonovHave fun,
14650aadb33SDmitri Tikhonov
14750aadb33SDmitri TikhonovLiteSpeed QUIC Team.
14850aadb33SDmitri Tikhonov
1495296a94bSDmitri TikhonovCopyright (c) 2017 - 2018 LiteSpeed Technologies Inc
150