macula_nat_connector (macula v0.20.5)
View SourceNAT-aware Peer Connector.
Provides intelligent connection establishment using the optimal strategy based on NAT profiles. Integrates: - NAT coordinator for strategy determination - Hole punch executor for direct connections - Relay fallback when direct fails
Connection Strategy Order: 1. Direct - If target can receive unsolicited (Full Cone NAT) 2. Hole Punch - If NAT profiles indicate feasibility 3. Relay - Fallback via gateway
Usage: connect(TargetNodeId, Opts) to establish connection.
Summary
Functions
Connect to a peer using optimal strategy. Automatically determines best approach based on NAT profiles.
Connect with options.
Disconnect from a peer.
Types
-type connect_result() :: {ok, quicer:connection_handle(), direct | hole_punch | relay} | {error, term()}.
Functions
-spec connect(binary(), binary()) -> connect_result().
Connect to a peer using optimal strategy. Automatically determines best approach based on NAT profiles.
-spec connect(binary(), binary(), connect_opts()) -> connect_result().
Connect with options.
-spec disconnect(quicer:connection_handle()) -> ok.
Disconnect from a peer.