macula_quic (macula v0.20.3)
View SourceMain API module for Macula QUIC transport. Provides a simplified wrapper around the quicer library.
Summary
Functions
Accept an incoming connection on a listener. After accepting, the connection needs handshake to complete.
Accept an incoming stream on a connection.
Send data on a stream asynchronously (non-blocking). This returns immediately without waiting for QUIC flow control.
Close a listener, connection, or stream. Tries stream, then connection, then listener close in sequence.
Connect to a QUIC server. Options: {alpn, [Protocol]} - List of ALPN protocols {verify, none | verify_peer} - Certificate verification mode {cacertfile, Path} - CA certificate bundle for verification (v0.16.3+) {depth, N} - Max certificate chain depth (v0.16.3+) {server_name_indication, Host} - SNI hostname (v0.16.3+) {idle_timeout_ms, N} - Connection idle timeout in milliseconds {keep_alive_interval_ms, N} - Keep-alive PING interval in milliseconds
Start a QUIC listener on the specified port. Options: {cert, CertFile} - Path to PEM certificate file {key, KeyFile} - Path to PEM private key file {alpn, [Protocol]} - List of ALPN protocols (e.g., ["macula"]) {peer_unidi_stream_count, N} - Max unidirectional streams {peer_bidi_stream_count, N} - Max bidirectional streams {idle_timeout_ms, N} - Connection idle timeout in milliseconds {keep_alive_interval_ms, N} - Keep-alive PING interval in milliseconds
Open a new bidirectional stream on a connection.
Get the peer's address from a stream or connection handle. Returns {ok, {IP, Port}} on success or {error, Reason} on failure. Works with both stream and connection handles.
Receive data from a stream (blocking).
Send data on a stream (blocking).
Functions
Accept an incoming connection on a listener. After accepting, the connection needs handshake to complete.
Accept an incoming stream on a connection.
Send data on a stream asynchronously (non-blocking). This returns immediately without waiting for QUIC flow control.
-spec close(reference()) -> ok.
Close a listener, connection, or stream. Tries stream, then connection, then listener close in sequence.
-spec connect(string() | inet:ip_address(), inet:port_number(), list(), timeout()) -> {ok, reference()} | {error, term()}.
Connect to a QUIC server. Options: {alpn, [Protocol]} - List of ALPN protocols {verify, none | verify_peer} - Certificate verification mode {cacertfile, Path} - CA certificate bundle for verification (v0.16.3+) {depth, N} - Max certificate chain depth (v0.16.3+) {server_name_indication, Host} - SNI hostname (v0.16.3+) {idle_timeout_ms, N} - Connection idle timeout in milliseconds {keep_alive_interval_ms, N} - Keep-alive PING interval in milliseconds
-spec listen(inet:port_number(), list()) -> {ok, reference()} | {error, term()}.
Start a QUIC listener on the specified port. Options: {cert, CertFile} - Path to PEM certificate file {key, KeyFile} - Path to PEM private key file {alpn, [Protocol]} - List of ALPN protocols (e.g., ["macula"]) {peer_unidi_stream_count, N} - Max unidirectional streams {peer_bidi_stream_count, N} - Max bidirectional streams {idle_timeout_ms, N} - Connection idle timeout in milliseconds {keep_alive_interval_ms, N} - Keep-alive PING interval in milliseconds
Open a new bidirectional stream on a connection.
-spec peername(term()) -> {ok, {inet:ip_address(), inet:port_number()}} | {error, term()}.
Get the peer's address from a stream or connection handle. Returns {ok, {IP, Port}} on success or {error, Reason} on failure. Works with both stream and connection handles.
Receive data from a stream (blocking).
Send data on a stream (blocking).