Files
ddns-updater/internal/update/interfaces.go
Quentin McGaw ec4411e12d feat(healthchecks.io): fail and exit codes support
- notify with `/fail` suffix if any update failed
- notify with `/0` on program exit with 0 code
- notify with `/1` on program exit with 1 code
2024-02-09 13:47:29 +00:00

46 lines
998 B
Go

package update
import (
"context"
"net"
"net/netip"
"github.com/qdm12/ddns-updater/internal/healthchecksio"
"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, ip netip.Addr) (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, state healthchecksio.State) (err error)
}