refactor: shared service layer, default IRC port, smaller functions
All checks were successful
check / check (push) Successful in 2m37s

Wire up service.Service in HTTP handlers and delegate cleanupUser to
svc.BroadcastQuit for consistent quit/part logic across transports.
Default IRC_LISTEN_ADDR to :6667, remove unused import, fix all lint
issues (dogsled, funcorder, wrapcheck, varnamelen, nolintlint).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
user
2026-03-25 13:39:32 -07:00
parent 42157a7b23
commit 2853dc8a1f
10 changed files with 1100 additions and 812 deletions

View File

@@ -17,6 +17,7 @@ import (
"git.eeqj.de/sneak/neoirc/internal/healthcheck"
"git.eeqj.de/sneak/neoirc/internal/logger"
"git.eeqj.de/sneak/neoirc/internal/ratelimit"
"git.eeqj.de/sneak/neoirc/internal/service"
"git.eeqj.de/sneak/neoirc/internal/stats"
"go.uber.org/fx"
)
@@ -34,6 +35,7 @@ type Params struct {
Healthcheck *healthcheck.Healthcheck
Stats *stats.Tracker
Broker *broker.Broker
Service *service.Service
}
const defaultIdleTimeout = 30 * 24 * time.Hour
@@ -49,6 +51,7 @@ type Handlers struct {
log *slog.Logger
hc *healthcheck.Healthcheck
broker *broker.Broker
svc *service.Service
hashcashVal *hashcash.Validator
channelHashcash *hashcash.ChannelValidator
loginLimiter *ratelimit.Limiter
@@ -81,6 +84,7 @@ func New(
log: params.Logger.Get(),
hc: params.Healthcheck,
broker: params.Broker,
svc: params.Service,
hashcashVal: hashcash.NewValidator(resource),
channelHashcash: hashcash.NewChannelValidator(),
loginLimiter: ratelimit.New(loginRate, loginBurst),