Skip to content

emqx/quic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

10b6b67 · Feb 19, 2024
Dec 20, 2023
Feb 24, 2021
Feb 19, 2024
Dec 18, 2023
Feb 19, 2024
Feb 24, 2021
Feb 19, 2024
Nov 7, 2023
Feb 19, 2024
Feb 19, 2024
May 11, 2021
Jan 11, 2024
Apr 8, 2022
Sep 29, 2022
May 10, 2022
Dec 20, 2023
Jan 27, 2020
Feb 19, 2024
Nov 24, 2023
Jan 11, 2024
Apr 25, 2022
Jan 11, 2024
Sep 19, 2023
Jan 24, 2024
Jun 9, 2023

Repository files navigation

quicer

QUIC protocol erlang library.

msquic NIF binding.

Project Status: WIP (actively), POC quality

API: is not stable, might be changed in the future.

Erlang CI License Coverage Status

OS Support

OS Status
Linux Supported
macOS Supported
Windows TBD

BUILD

Dependencies

  1. OTP22+
  2. rebar3
  3. cmake3.16+
  4. CLOG (required for debug logging only)
  5. LTTNG2.12 (required for debug build only)

With DEBUG

Debug build dependency: CLOG

$ rebar3 compile 
# OR
$ make

note,

To enable logging and release build:

export CMAKE_BUILD_TYPE=Debug
export QUIC_ENABLE_LOGGING=ON
export QUICER_USE_LTTNG=1
make

BUILD with logging to stdout

QUIC_LOGGING_TYPE=stdout make

Without DEBUG

export CMAKE_BUILD_TYPE=Release
make

Examples

Ping Pong server and client

Server

application:ensure_all_started(quicer),
Port = 4567,
LOptions = [ {certfile, "cert.pem"}
           , {keyfile,  "key.pem"}
           , {alpn, ["sample"]}
           , {peer_bidi_stream_count, 1}
             ],
{ok, L} = quicer:listen(Port, LOptions),
{ok, Conn} = quicer:accept(L, [], 120000),
{ok, Conn} = quicer:handshake(Conn),
{ok, Stm} = quicer:accept_stream(Conn, []),
receive {quic, <<"ping">>, Stm, _Props} -> ok end,
{ok, 4} = quicer:send(Stm, <<"pong">>),
quicer:close_listener(L).

Client

application:ensure_all_started(quicer),
Port = 4567,
{ok, Conn} = quicer:connect("localhost", Port, [{alpn, ["sample"]}, {verify, none}], 5000),
{ok, Stm} = quicer:start_stream(Conn, []),
{ok, 4} = quicer:send(Stm, <<"ping">>),
receive {quic, <<"pong">>, Stm, _Props} -> ok end,
ok = quicer:close_connection(Conn).

TEST

$ make test

Documentation

$ make doc

Then check the doc in browser:

$ firefox doc/index.html

License

Apache License Version 2.0