quic_dist (quic v0.11.0)

View Source

Erlang distribution protocol implementation over QUIC.

This module implements the Erlang distribution protocol callbacks using QUIC as the transport layer. It provides:

- Connection establishment via TLS 1.3 (built into QUIC) - Multiple streams for parallel message delivery - Head-of-line blocking avoidance - Connection migration for NAT traversal - 0-RTT reconnection for fast session resumption

Configuration

Enable QUIC distribution in vm.args:

   -proto_dist quic
   -epmd_module quic_epmd
   -start_epmd false

Configure in sys.config:

   {quic, [
     {dist, [
       {cert_file, "/path/to/cert.pem"},
       {key_file, "/path/to/key.pem"},
       {cacert_file, "/path/to/ca.pem"},
       {verify, verify_peer}
     ]}
   ]}

Summary

Functions

Accept a connection from the distribution listener.

Handle an accepted connection. Called by net_kernel when a new connection is accepted.

Return the address family to use.

Close the distribution listener.

Check if a node name is valid.

Start listening for incoming distribution connections.

Start listening with options.

Check if this distribution module should be used for the given node. Returns true if the node name is valid and we can potentially connect.

Set up an outgoing distribution connection. Called by net_kernel to establish a connection to another node.

Functions

accept(Listen)

-spec accept(Listen :: term()) -> AcceptPid :: pid().

Accept a connection from the distribution listener.

accept_connection(AcceptPid, Socket, MyNode, Allowed, SetupTime)

-spec accept_connection(AcceptPid :: pid(),
                        Socket :: term(),
                        MyNode :: node(),
                        Allowed :: term(),
                        SetupTime :: non_neg_integer()) ->
                           pid().

Handle an accepted connection. Called by net_kernel when a new connection is accepted.

address()

-spec address() -> #net_address{address :: term(), host :: term(), protocol :: term(), family :: term()}.

Return the address family to use.

close(Listen)

-spec close(Listen :: term()) -> ok.

Close the distribution listener.

is_node_name(Node)

-spec is_node_name(atom()) -> boolean().

Check if a node name is valid.

listen(Name)

-spec listen(Name :: atom()) ->
                {ok, {LSocket :: term(), TcpAddress :: term(), Creation :: non_neg_integer()}} |
                {error, Reason :: term()}.

Start listening for incoming distribution connections.

listen(Name, Opts)

-spec listen(Name :: atom(), Opts :: map()) ->
                {ok, {LSocket :: term(), TcpAddress :: term(), Creation :: non_neg_integer()}} |
                {error, Reason :: term()}.

Start listening with options.

select(Node)

-spec select(node()) -> boolean().

Check if this distribution module should be used for the given node. Returns true if the node name is valid and we can potentially connect.

setup(Node, Type, MyNode, LongOrShortNames, SetupTime)

-spec setup(Node :: node(),
            Type :: atom(),
            MyNode :: node(),
            LongOrShortNames :: shortnames | longnames,
            SetupTime :: non_neg_integer()) ->
               pid().

Set up an outgoing distribution connection. Called by net_kernel to establish a connection to another node.