update

package
v0.0.0-...-542e895 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIPv6NotSupported = errors.New("IPv6 is not supported on this system")
)

Functions

This section is empty.

Types

type Database

type Database interface {
	Select(recordID uint) (record records.Record, err error)
	SelectAll() (records []records.Record)
	Update(recordID uint, record records.Record) (err error)
}

type DebugLogger

type DebugLogger interface {
	Debug(s string)
}

type HealthchecksIOClient

type HealthchecksIOClient interface {
	Ping(ctx context.Context, state healthchecksio.State) (err error)
}

type Logger

type Logger interface {
	DebugLogger
	Info(s string)
	Warn(s string)
	Error(s string)
}

type LookupIPer

type LookupIPer interface {
	LookupIP(ctx context.Context, network, host string) (ips []net.IP, err error)
}

type PublicIPFetcher

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 Runner

type Runner struct {
	// contains filtered or unexported fields
}

func NewRunner

func NewRunner(db Database, updater UpdaterInterface, ipGetter PublicIPFetcher,
	period time.Duration, cooldown time.Duration, logger Logger, resolver LookupIPer,
	timeNow func() time.Time, hioClient HealthchecksIOClient) *Runner

func (*Runner) ForceUpdate

func (r *Runner) ForceUpdate(ctx context.Context) (errs []error)

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, done chan<- struct{})

type ShoutrrrClient

type ShoutrrrClient interface {
	Notify(message string)
}

type Updater

type Updater struct {
	// contains filtered or unexported fields
}

func NewUpdater

func NewUpdater(db Database, client *http.Client, shoutrrrClient ShoutrrrClient,
	logger DebugLogger, timeNow func() time.Time) *Updater

func (*Updater) Update

func (u *Updater) Update(ctx context.Context, id uint, ip netip.Addr) (err error)

type UpdaterInterface

type UpdaterInterface interface {
	Update(ctx context.Context, recordID uint, ip netip.Addr) (err error)
}

Directories

Path Synopsis
Package mock_update is a generated GoMock package.
Package mock_update is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL