provider

package
v0.4.13 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package provider contains abstractions for advertising DNS-SD services by manipulating DNS records.

Index

Constants

View Source
const Timeout = 10 * time.Second

Timeout is the timeout for all provider operations.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advertiser

type Advertiser interface {
	// ID returns a data-structure that unique identifies this advertiser within
	// the provider that created it.
	ID() map[string]any

	// Advertise adds/updates DNS records to advertise the given service
	// instance.
	Advertise(ctx context.Context, inst dnssd.ServiceInstance) (ChangeSet, error)

	// Advertise removes/updates DNS records to stop advertising the given
	// service instance.
	Unadvertise(ctx context.Context, inst dnssd.ServiceInstance) (ChangeSet, error)
}

Advertiser is an interface for advertising DNS-SD service instances on a specific domain.

type Change added in v0.2.0

type Change int

Change is a bit-field that describes the changes made to a specific DNS record.

const (
	// NoChange indicates that no changes were made.
	NoChange Change = 0

	// Created indicates that a record of this type was created.
	Created Change = 1 << iota

	// Updated indicates that a record of this type was updated.
	Updated

	// Deleted indicates that a record of this type was deleted.
	Deleted
)

type ChangeSet added in v0.2.0

type ChangeSet struct {
	PTR Change
	SRV Change
	TXT Change
}

ChangeSet describes the changes made to DNS records.

func (ChangeSet) IsCreate added in v0.2.0

func (cs ChangeSet) IsCreate() bool

IsCreate returns true if the change set represents an entirely new instance.

func (ChangeSet) IsEmpty added in v0.2.0

func (cs ChangeSet) IsEmpty() bool

IsEmpty returns true if no changes were made.

type Provider

type Provider interface {
	// ID returns a unique identifier for the provider.
	ID() string

	// Describe returns a human-readable description of the provider.
	Describe() string

	// AdvertiserByID returns the Advertiser with the given identity structure.
	AdvertiserByID(ctx context.Context, id map[string]any) (Advertiser, error)

	// AdvertiserByDomain returns the Advertiser used to advertise services on
	// the given domain.
	//
	// ok is false if this provider does not manage the given domain.
	AdvertiserByDomain(ctx context.Context, domain string) (_ Advertiser, ok bool, _ error)
}

Provider is an interface for advertising DNS-SD service instances on domains hosted by a specific hosting provider.

Directories

Path Synopsis
Package dnsimpleprovider provides a driver implementation that advertises DNS-SD service instances on domain names hosted by dnsimple.com.
Package dnsimpleprovider provides a driver implementation that advertises DNS-SD service instances on domain names hosted by dnsimple.com.
internal/dnsimplex
Package dnsimplex contains utility functions for working with the DNSimple API.
Package dnsimplex contains utility functions for working with the DNSimple API.
internal
providertest
Package providertest contains a standard test suite for provider implementations.
Package providertest contains a standard test suite for provider implementations.
Package route53provider provides a driver implementation that advertises DNS-SD service instances on domain names hosted by Amazon Route 53.
Package route53provider provides a driver implementation that advertises DNS-SD service instances on domain names hosted by Amazon Route 53.

Jump to

Keyboard shortcuts

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