hackney_quic (hackney v3.2.1)

View Source

QUIC/HTTP3 transport using pure Erlang QUIC library.

This module wraps the quic application to provide HTTP/3 support. It handles: - QUIC connection management - HTTP/3 framing (HEADERS, DATA frames) - QPACK header compression

Messages

Messages sent to owner process:

  • {quic, ConnRef, {connected, Info}} - Connection established
  • {quic, ConnRef, {stream_headers, StreamId, Headers, Fin}} - Headers received
  • {quic, ConnRef, {stream_data, StreamId, Bin, Fin}} - Data received
  • {quic, ConnRef, {stream_reset, StreamId, ErrorCode}} - Stream reset
  • {quic, ConnRef, {closed, Reason}} - Connection closed
  • {quic, ConnRef, {transport_error, Code, Reason}} - Transport error

Summary

Functions

Close a QUIC connection.

Connect to a QUIC/HTTP3 server.

Get the file descriptor from a gen_udp socket. Not needed for pure Erlang implementation, kept for API compatibility.

Handle connection timeout.

Check if QUIC/HTTP3 support is available. Always returns true as pure Erlang implementation is always available.

Open a new bidirectional stream.

Get the remote address of the connection.

Process pending QUIC events.

Reset a stream with an error code.

Send HTTP/3 headers on a stream.

Set connection options.

Get the local address of the connection.

Functions

close(ConnRef, Reason)

-spec close(ConnRef, Reason) -> ok when ConnRef :: reference(), Reason :: term().

Close a QUIC connection.

connect(Host, Port, Opts, Owner)

-spec connect(Host, Port, Opts, Owner) -> {ok, reference()} | {error, term()}
                 when
                     Host :: binary() | string(),
                     Port :: inet:port_number(),
                     Opts :: map(),
                     Owner :: pid().

Connect to a QUIC/HTTP3 server.

get_fd(Socket)

-spec get_fd(gen_udp:socket()) -> {ok, integer()} | {error, term()}.

Get the file descriptor from a gen_udp socket. Not needed for pure Erlang implementation, kept for API compatibility.

handle_call(Request, From, State)

handle_cast(Msg, State)

handle_info(Msg, State)

handle_timeout(ConnRef, NowMs)

-spec handle_timeout(ConnRef, NowMs) -> non_neg_integer() | infinity
                        when ConnRef :: reference(), NowMs :: non_neg_integer().

Handle connection timeout.

init(_)

is_available()

-spec is_available() -> true.

Check if QUIC/HTTP3 support is available. Always returns true as pure Erlang implementation is always available.

open_stream(ConnRef)

-spec open_stream(ConnRef) -> {ok, non_neg_integer()} | {error, term()} when ConnRef :: reference().

Open a new bidirectional stream.

peername(ConnRef)

-spec peername(ConnRef) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, term()}
                  when ConnRef :: reference().

Get the remote address of the connection.

process(ConnRef)

-spec process(ConnRef) -> non_neg_integer() | infinity when ConnRef :: reference().

Process pending QUIC events.

reset_stream(ConnRef, StreamId, ErrorCode)

-spec reset_stream(ConnRef, StreamId, ErrorCode) -> ok | {error, term()}
                      when
                          ConnRef :: reference(),
                          StreamId :: non_neg_integer(),
                          ErrorCode :: non_neg_integer().

Reset a stream with an error code.

send_data(ConnRef, StreamId, Data, Fin)

-spec send_data(ConnRef, StreamId, Data, Fin) -> ok | {error, term()}
                   when
                       ConnRef :: reference(),
                       StreamId :: non_neg_integer(),
                       Data :: iodata(),
                       Fin :: boolean().

Send data on a stream.

send_headers(ConnRef, StreamId, Headers, Fin)

-spec send_headers(ConnRef, StreamId, Headers, Fin) -> ok | {error, term()}
                      when
                          ConnRef :: reference(),
                          StreamId :: non_neg_integer(),
                          Headers :: [{binary(), binary()}],
                          Fin :: boolean().

Send HTTP/3 headers on a stream.

setopts(ConnRef, Opts)

-spec setopts(ConnRef, Opts) -> ok | {error, term()}
                 when ConnRef :: reference(), Opts :: [{atom(), term()}].

Set connection options.

sockname(ConnRef)

-spec sockname(ConnRef) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, term()}
                  when ConnRef :: reference().

Get the local address of the connection.

terminate(Reason, State)