macula_gateway_quic_server (macula v0.25.1)
View SourceQUIC Transport Layer Gen_Server
Handles all QUIC transport operations for the gateway: - Owns QUIC listener - Receives {quic, ...} events - Decodes protocol messages - Routes messages to gateway for business logic
This separation follows proper OTP design: - One process, one responsibility (transport vs routing) - Clean fault isolation (QUIC crashes don't crash gateway) - Proper supervision (supervisor can restart independently) - Testability (can test transport in isolation)
Summary
Functions
Handle synchronous calls. Set gateway PID for message routing
Handle asynchronous casts.
Handle QUIC event: new_stream (stream created by peer). Associates the stream with its parent connection to enable peer address lookup.
Initialize the QUIC server and start QUIC listener.
Set the gateway PID for message routing. Called by supervisor after both quic_server and gateway have started.
Returns shield metrics: recent connections with IPs, timestamps, and status. Reads directly from named ETS tables. No gen_server call needed. Returns empty metrics if the QUIC server has not started yet.
Start the QUIC server gen_server.
Cleanup on termination.
Functions
Handle synchronous calls. Set gateway PID for message routing
Handle asynchronous casts.
Handle QUIC event: new_stream (stream created by peer). Associates the stream with its parent connection to enable peer address lookup.
Initialize the QUIC server and start QUIC listener.
Set the gateway PID for message routing. Called by supervisor after both quic_server and gateway have started.
-spec shield_metrics() -> map().
Returns shield metrics: recent connections with IPs, timestamps, and status. Reads directly from named ETS tables. No gen_server call needed. Returns empty metrics if the QUIC server has not started yet.
-spec start_link(Opts :: proplists:proplist()) -> {ok, pid()} | {error, term()}.
Start the QUIC server gen_server.
Cleanup on termination.