macula_tun_reader_proxy (macula v4.2.7)
View SourceOwns the inbound TUN-reader mailbox.
The native TUN reader (see macula_tun:start_reader/2) sends {macula_net_packet, Handle, Payload} to a registered consumer process. This module IS that consumer — a long-lived gen_server that dispatches every received payload to the configured dispatch_fn. Production wires it to macula_route_packet:dispatch/1; tests pass a capture fun.
Replaces an earlier hand-rolled receive...loop inside macula_net per the workspace rule "every receive loop is a gen_server candidate". OTP supervision, restart semantics, and sys/dbg tracing all come for free.
Summary
Types
-type config() :: #{dispatch_fn := dispatch_fn()}.