-
-
Notifications
You must be signed in to change notification settings - Fork 144
/
interfaces.go
45 lines (36 loc) · 998 Bytes
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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)
}