hackney_quic (hackney v3.2.1)
View SourceQUIC/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 data on a stream.
Send HTTP/3 headers on a stream.
Set connection options.
Get the local address of the connection.
Functions
Close a QUIC connection.
-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.
-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.
-spec handle_timeout(ConnRef, NowMs) -> non_neg_integer() | infinity when ConnRef :: reference(), NowMs :: non_neg_integer().
Handle connection timeout.
-spec is_available() -> true.
Check if QUIC/HTTP3 support is available. Always returns true as pure Erlang implementation is always available.
-spec open_stream(ConnRef) -> {ok, non_neg_integer()} | {error, term()} when ConnRef :: reference().
Open a new bidirectional stream.
-spec peername(ConnRef) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, term()} when ConnRef :: reference().
Get the remote address of the connection.
-spec process(ConnRef) -> non_neg_integer() | infinity when ConnRef :: reference().
Process pending QUIC events.
-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.
-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.
-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.
-spec setopts(ConnRef, Opts) -> ok | {error, term()} when ConnRef :: reference(), Opts :: [{atom(), term()}].
Set connection options.
-spec sockname(ConnRef) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, term()} when ConnRef :: reference().
Get the local address of the connection.