Full project structure following upaas conventions: uber/fx DI, go-chi routing, slog logging, Viper config. State persisted as JSON file with per-nameserver record tracking for inconsistency detection. Stub implementations for resolver, portcheck, tlscheck, and watcher.
49 lines
887 B
Go
49 lines
887 B
Go
// Package portcheck provides TCP port connectivity checking.
|
|
package portcheck
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"log/slog"
|
|
|
|
"go.uber.org/fx"
|
|
|
|
"sneak.berlin/go/dnswatcher/internal/logger"
|
|
)
|
|
|
|
// ErrNotImplemented indicates the port checker is not yet implemented.
|
|
var ErrNotImplemented = errors.New(
|
|
"port checker not yet implemented",
|
|
)
|
|
|
|
// Params contains dependencies for Checker.
|
|
type Params struct {
|
|
fx.In
|
|
|
|
Logger *logger.Logger
|
|
}
|
|
|
|
// Checker performs TCP port connectivity checks.
|
|
type Checker struct {
|
|
log *slog.Logger
|
|
}
|
|
|
|
// New creates a new port Checker instance.
|
|
func New(
|
|
_ fx.Lifecycle,
|
|
params Params,
|
|
) (*Checker, error) {
|
|
return &Checker{
|
|
log: params.Logger.Get(),
|
|
}, nil
|
|
}
|
|
|
|
// CheckPort tests TCP connectivity to the given address and port.
|
|
func (c *Checker) CheckPort(
|
|
_ context.Context,
|
|
_ string,
|
|
_ int,
|
|
) (bool, error) {
|
|
return false, ErrNotImplemented
|
|
}
|