macula_net (macula v4.3.0)
View Sourcemacula-net facade.
Sovereign IPv6 substrate for the macula realm. Crypto-derived addresses, multi-realm identity, no central allocation authority. See PLAN_MACULA_NET.md for the full spec.
This module orchestrates the slices:
macula_address— pubkey -> IPv6macula_tun— kernel-side TUNmacula_net_transport_quic— wire transport (Quinn)macula_route_packet— egress: TUN packet -> stationmacula_deliver_packet— ingress: envelope -> TUN
Lifecycle
{ok, _} = macula_net:start(#{
realm_pubkey => <<...32 bytes...>>,
identity_pubkey => <<...32 bytes...>>,
tun_name => <<"macula0">>,
tun_mtu => 1280,
quic_port => 4400,
peers => [
#{station => <<"beam02">>,
host => "192.168.1.12", port => 4400,
addresses => [<<...16 bytes...>>]}
]
}).
Summary
Functions
Derive a macula-net IPv6 address. See macula_address:derive/2.
Format a 16-byte IPv6 binary as RFC 5952 lowercase text.
Return THIS node's macula-net address (set by start/1).
Bring up macula-net for this node with the supplied config.
Bring everything down.
Types
-type node_config() :: #{realm_pubkey := <<_:256>>, identity_pubkey := <<_:256>>, tun_name := binary(), tun_mtu := 1280..65535, quic_port := inet:port_number(), peers := [peer_spec()]}.
-type peer_spec() :: #{station := binary(), host := binary() | string(), port := inet:port_number(), addresses := [<<_:128>>]}.
Functions
-spec derive_address(<<_:256>>, <<_:256>>) -> <<_:128>>.
Derive a macula-net IPv6 address. See macula_address:derive/2.
-spec format_address(<<_:128>>) -> binary().
Format a 16-byte IPv6 binary as RFC 5952 lowercase text.
-spec own_address() -> <<_:128>> | undefined.
Return THIS node's macula-net address (set by start/1).
-spec start(node_config()) -> {ok, pid()} | {error, term()}.
Bring up macula-net for this node with the supplied config.
-spec stop() -> ok.
Bring everything down.