service

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package service provides the DDNS service implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountConfig

type AccountConfig struct {
	// Name is the name of the account.
	Name string `json:"name"`

	// Type is the type of the account.
	//
	//   - "cloudflare": Cloudflare.
	Type string `json:"type"`

	// Bearertoken is the bearer token for the account.
	BearerToken string `json:"bearer_token"`
}

AccountConfig contains configuration options for a provider account.

type Config

type Config struct {
	// Sources is the configuration for the producer sources.
	Sources []SourceConfig `json:"sources"`

	// Accounts is the configuration for the provider accounts.
	Accounts []AccountConfig `json:"accounts"`

	// Domains is the configuration for the managed domains.
	Domains []DomainConfig `json:"domains"`

	// StartupDelay is the amount of time to wait before starting the service.
	// This can be useful if the service is started before the network is ready.
	StartupDelay jsonhelper.Duration `json:"startup_delay"`
}

Config contains the configuration options for the DDNS service.

func (*Config) NewService added in v1.1.0

func (cfg *Config) NewService(logger *tslog.Logger) (*Service, error)

NewService creates a new Service from the configuration.

type DomainConfig

type DomainConfig struct {
	// Domain is the domain to manage.
	Domain string `json:"domain"`

	// Provider is the DNS provider for the domain.
	//
	//   - "cloudflare": Cloudflare.
	Provider string `json:"provider"`

	// Cloudflare is the configuration for a Cloudflare domain.
	Cloudflare cloudflare.KeeperConfig `json:"cloudflare"`

	// Account is the name of the provider account to use.
	Account string `json:"account"`

	// IPv4Source is the name of the source for the domain's IPv4 address.
	// If empty, the domain's IPv4 address is not managed.
	IPv4Source string `json:"ipv4_source"`

	// IPv6Source is the name of the source for the domain's IPv6 address.
	// If empty, the domain's IPv6 address is not managed.
	IPv6Source string `json:"ipv6_source"`
}

DomainConfig contains configuration options for a managed domain.

type DomainManager

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

DomainManager manages the DNS records of a domain.

func NewDomainManager

func NewDomainManager(
	v4ch, v6ch <-chan producer.Message,
	keeper provider.RecordKeeper,
	logger *tslog.Logger,
) *DomainManager

NewDomainManager creates a new DomainManager.

func (*DomainManager) Run

func (m *DomainManager) Run(ctx context.Context)

Run initiates the domain manager's record management process. It blocks until the provided context is canceled.

type Service added in v1.1.0

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

Service is the DDNS service.

func (*Service) Run added in v1.1.0

func (s *Service) Run(ctx context.Context)

Run starts the DDNS service. It blocks until the provided context is canceled.

type SourceConfig

type SourceConfig struct {
	// Name is the name of the source.
	Name string `json:"name"`

	// Type is the type of the source.
	//
	//   - "asusrouter": ASUS router.
	//   - "ipapi": IP address API.
	//   - "iface": Network interface (generic).
	//   - "netlink": Network interface (Linux).
	//   - "bsdroute": Network interface (Darwin, DragonFly BSD, FreeBSD, NetBSD, OpenBSD).
	//   - "win32iphlp": Network interface (Windows).
	Type string `json:"type"`

	// ASUSRouter is the producer configuration for an ASUS router source.
	ASUSRouter asusrouter.ProducerConfig `json:"asusrouter"`

	// IPAPI is the producer configuration for an IP address API source.
	IPAPI ipapi.ProducerConfig `json:"ipapi"`

	// Iface is the producer configuration for a generic network interface source.
	Iface iface.ProducerConfig `json:"iface"`

	// Netlink is the producer configuration for a netlink network interface source.
	Netlink netlink.ProducerConfig `json:"netlink"`

	// BSDRoute is the producer configuration for a bsdroute network interface source.
	BSDRoute bsdroute.ProducerConfig `json:"bsdroute"`

	// Win32IPHLP is the producer configuration for a win32iphlp network interface source.
	Win32IPHLP win32iphlp.ProducerConfig `json:"win32iphlp"`
}

SourceConfig contains configuration options for a producer source.

func (*SourceConfig) NewProducer

func (cfg *SourceConfig) NewProducer(client *http.Client, logger *tslog.Logger) (producer.Producer, error)

NewProducer creates a new producer.Producer from the configuration.

Jump to

Keyboard shortcuts

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