updater

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package updater pushes IP address updates to dynamic DNS services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddIP

func AddIP(a net.IP, b net.IP) net.IP

AddIP adds together the hexadecimal contents of the provided IP addresses.

func MaskIP

func MaskIP(ip net.IP, mask int) net.IP

MaskIP zeroes out the specified number of lower bits in the provided IP address.

func RecordTypeString

func RecordTypeString(rtype RecordType) string

RecordTypeString returns the string equivalent to a RecordType value.

func SlaacBits

func SlaacBits(mac net.HardwareAddr) net.IP

SlaacBits returns an IPv6 address with the lower 64 bits derived from the provided MAC address using the EUI-64 derivation.

Types

type CloudflareService

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

func (*CloudflareService) Identifier

func (s *CloudflareService) Identifier() string

func (*CloudflareService) Submit

func (s *CloudflareService) Submit(ctx context.Context, rtype RecordType, ip net.IP) (retryAfter time.Duration, err error)

func (*CloudflareService) SupportsRecord

func (s *CloudflareService) SupportsRecord(rtype RecordType) bool

func (*CloudflareService) UnmarshalYAML

func (s *CloudflareService) UnmarshalYAML(value *yaml.Node) error

type DuckService

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

func (*DuckService) Identifier

func (s *DuckService) Identifier() string

func (*DuckService) Submit

func (s *DuckService) Submit(ctx context.Context, rtype RecordType, ip net.IP) (retryAfter time.Duration, err error)

func (*DuckService) SupportsRecord

func (s *DuckService) SupportsRecord(rtype RecordType) bool

func (*DuckService) UnmarshalYAML

func (s *DuckService) UnmarshalYAML(value *yaml.Node) error

type GoogleService

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

func (*GoogleService) Identifier

func (s *GoogleService) Identifier() string

func (*GoogleService) Submit

func (s *GoogleService) Submit(ctx context.Context, rtype RecordType, ip net.IP) (retryAfter time.Duration, err error)

func (*GoogleService) SupportsRecord

func (s *GoogleService) SupportsRecord(rtype RecordType) bool

func (*GoogleService) UnmarshalYAML

func (s *GoogleService) UnmarshalYAML(value *yaml.Node) error

type IPLookup

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

func NewIPLookup

func NewIPLookup() IPLookup

func (IPLookup) WebFacingIP

func (l IPLookup) WebFacingIP(ctx context.Context, rtype RecordType, intname string) net.IP

type RecordService

type RecordService interface {
	// Submit a new record value.
	Submit(context.Context, RecordType, net.IP) (retryAfter time.Duration, err error)

	// Retrieve a human-readable name for this record.
	Identifier() string

	// Determine support for a record type.
	SupportsRecord(RecordType) bool

	yaml.Unmarshaler
}

A RecordService manages transactions concerning a particular record with a dynamic DNS service.

type RecordType

type RecordType int
const (
	ARecord RecordType = iota
	AAAARecord
)

type Updater

type Updater struct {
	Type       RecordType
	Interface  string
	Service    RecordService
	IPOffset   net.IP
	IPMaskBits int

	yaml.Unmarshaler
	// contains filtered or unexported fields
}

An Updater manages a single DNS record.

func (*Updater) DryRun

func (u *Updater) DryRun(ctx context.Context, logger *log.Logger)

DryRun performs an IP address lookup, but does not refresh the record.

func (*Updater) UnmarshalYAML

func (u *Updater) UnmarshalYAML(value *yaml.Node) error

func (*Updater) Update

func (u *Updater) Update(ctx context.Context, logger *log.Logger)

Update attempts to refresh the record if necessary. It should be called every few minutes.

type Updaters

type Updaters []*Updater

Updaters represents a slice of updaters defined by a YAML configuration. All updaters share the same IP address lookup cache.

func (*Updaters) DryRun

func (u *Updaters) DryRun(ctx context.Context, logger *log.Logger)

DryRun tests all of the updaters in this slice.

func (*Updaters) UnmarshalYAML

func (u *Updaters) UnmarshalYAML(value *yaml.Node) error

func (*Updaters) Update

func (u *Updaters) Update(ctx context.Context, logger *log.Logger)

Update processes all of the updaters in this slice.

Jump to

Keyboard shortcuts

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