macula_dist (macula v0.14.3)

View Source

QUIC Distribution Carrier for Erlang.

This module implements the Erlang distribution carrier interface using QUIC transport via quicer. It replaces inet_tcp_dist to enable distributed Erlang over QUIC with:

- Built-in TLS 1.3 encryption (mandatory) - NAT-friendly UDP-based transport - Connection migration support - Stream multiplexing for message priorities - Decentralized discovery (no EPMD required)

Usage

Start the VM with: erl -proto_dist macula -no_epmd -start_epmd false

Or in vm.args: -proto_dist macula -no_epmd -start_epmd false -macula_dist_port 4433

Architecture: net_kernel - macula_dist - quicer - UDP/QUIC - remote node

Node naming convention: port@ip (e.g., 4433@192.168.1.100)

Summary

Functions

Accept incoming connections. Called in a loop by net_kernel.

Accept a distribution connection. This is called when a connection is being accepted from a remote node.

Return address information for this distribution.

Return child specifications for the distribution supervisor. Called by net_sup during startup.

Close a distribution connection.

Check if a string is a valid node name.

Listen for incoming distribution connections. Returns a "listen handle" used by accept/1.

Check if this module should handle distribution to the given node. Returns true if the node name is in port@host format.

Setup an outgoing distribution connection. Called when this node wants to connect to another node.

Split a node name into port and host. Node name format: port@host (e.g., 4433@192.168.1.100)

Functions

accept(ListenerHandle)

-spec accept(term()) -> pid().

Accept incoming connections. Called in a loop by net_kernel.

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

-spec accept_connection(pid(), term(), node(), term(), term()) -> pid().

Accept a distribution connection. This is called when a connection is being accepted from a remote node.

address()

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

Return address information for this distribution.

childspecs()

-spec childspecs() -> [supervisor:child_spec()].

Return child specifications for the distribution supervisor. Called by net_sup during startup.

close(QuicConn)

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

Close a distribution connection.

is_node_name(Name)

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

Check if a string is a valid node name.

listen(NodeName)

-spec listen(atom()) ->
                {ok,
                 {term(),
                  #net_address{address :: term(), host :: term(), protocol :: term(), family :: term()},
                  1..3}} |
                {error, term()}.

Listen for incoming distribution connections. Returns a "listen handle" used by accept/1.

select(Node)

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

Check if this module should handle distribution to the given node. Returns true if the node name is in port@host format.

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

-spec setup(node(), term(), atom(), term(), term()) -> pid().

Setup an outgoing distribution connection. Called when this node wants to connect to another node.

splitname(NodeName)

-spec splitname(atom() | string()) -> {integer(), string()} | false.

Split a node name into port and host. Node name format: port@host (e.g., 4433@192.168.1.100)