Files
ddns-updater-qdm12-3/internal/update/interfaces.go
Quentin McGaw 7525e870e3 wip
2024-01-28 07:28:29 +00:00

46 lines
944 B
Go

package update
import (
"context"
"net"
"net/netip"
"time"
"github.com/qdm12/ddns-updater/internal/records"
)
type PublicIPFetcher interface {
IP(ctx context.Context) (netip.Addr, error)
IP4(ctx context.Context) (netip.Addr, error)
IP6(ctx context.Context) (netip.Addr, error)
}
type UpdaterInterface interface {
Update(ctx context.Context, recordID uint, ipv4, ipv6 netip.Addr, now time.Time) (err error)
}
type Database interface {
Select(recordID uint) (record records.Record, err error)
SelectAll() (records []records.Record)
Update(recordID uint, record records.Record) (err error)
}
type LookupIPer interface {
LookupIP(ctx context.Context, network, host string) (ips []net.IP, err error)
}
type ShoutrrrClient interface {
Notify(message string)
}
type Logger interface {
DebugLogger
Info(s string)
Warn(s string)
Error(s string)
}
type HealthchecksIOClient interface {
Ping(ctx context.Context) (err error)
}