switch modules to accept an InputHandler instead of the full router

This commit is contained in:
Joel Wetzell
2026-05-20 21:03:41 -05:00
parent be0b1c4a5f
commit 4cedd58a76
31 changed files with 301 additions and 297 deletions
+11 -11
View File
@@ -14,15 +14,15 @@ import (
)
type UDPClient struct {
config config.ModuleConfig
Addr *net.UDPAddr
Port uint16
conn *net.UDPConn
ctx context.Context
router common.RouteIO
logger *slog.Logger
cancel context.CancelFunc
connMu sync.Mutex
config config.ModuleConfig
Addr *net.UDPAddr
Port uint16
conn *net.UDPConn
ctx context.Context
inputHandler common.InputHandler
logger *slog.Logger
cancel context.CancelFunc
connMu sync.Mutex
}
func init() {
@@ -83,9 +83,9 @@ func (uc *UDPClient) SetupConn() error {
return err
}
func (uc *UDPClient) Start(ctx context.Context, router common.RouteIO) error {
func (uc *UDPClient) Start(ctx context.Context, inputHandler common.InputHandler) error {
uc.logger.Debug("running")
uc.router = router
uc.inputHandler = inputHandler
moduleContext, cancel := context.WithCancel(ctx)
uc.ctx = moduleContext
uc.cancel = cancel