dns

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AlreadyAssignedErr = fmt.Errorf("managed host already assigned")
View Source
var (
	NoSuchHost = errors.New("no such host")
)

Functions

func IsNoSuchHostError

func IsNoSuchHostError(err error) bool

Types

type DefaultHostResolver

type DefaultHostResolver struct {
	Client dns.Client
}

func NewDefaultHostResolver

func NewDefaultHostResolver() *DefaultHostResolver

func (*DefaultHostResolver) LookupIPAddr

func (hr *DefaultHostResolver) LookupIPAddr(ctx context.Context, host string) ([]HostAddress, error)

type FakeProvider

type FakeProvider struct{}

func (*FakeProvider) Delete

func (_ *FakeProvider) Delete(record *v1.DNSRecord, zone v1.DNSZone) error

func (*FakeProvider) Ensure

func (_ *FakeProvider) Ensure(record *v1.DNSRecord, zone v1.DNSZone) error

type HostAddress

type HostAddress struct {
	Host string
	IP   gonet.IP
	TTL  time.Duration
	TXT  string
}

type HostResolver

type HostResolver interface {
	LookupIPAddr(ctx context.Context, host string) ([]HostAddress, error)
}

type Provider

type Provider interface {
	// Ensure will create or update record.
	Ensure(record *v1.DNSRecord, zone v1.DNSZone) error

	// Delete will delete record.
	Delete(record *v1.DNSRecord, zone v1.DNSZone) error
}

Provider knows how to manage DNS zones only as pertains to routing.

func DNSProvider

func DNSProvider(dnsProviderName string) (Provider, error)

type SafeHostResolver

type SafeHostResolver struct {
	HostResolver
	// contains filtered or unexported fields
}

func NewSafeHostResolver

func NewSafeHostResolver(inner HostResolver) *SafeHostResolver

func (*SafeHostResolver) LookupIPAddr

func (r *SafeHostResolver) LookupIPAddr(ctx context.Context, host string) ([]HostAddress, error)

type Service

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

func NewService

func NewService(controlClient client.Client, hostResolv HostResolver, defaultCtrlNS string) *Service

func (*Service) AddEndPoints

func (s *Service) AddEndPoints(ctx context.Context, traffic traffic.Interface) error

func (*Service) EnsureManagedHost

func (s *Service) EnsureManagedHost(ctx context.Context, t traffic.Interface) ([]string, []*v1.DNSRecord, error)

EnsureManagedHost will ensure there is at least one managed host for rthe traffic object and return those host and dnsrecords

func (*Service) GetDNSRecords

func (s *Service) GetDNSRecords(ctx context.Context, traffic traffic.Interface) ([]*v1.DNSRecord, error)

func (*Service) RegisterHost

func (s *Service) RegisterHost(ctx context.Context, h string, id string, zone v1.DNSZone) (*v1.DNSRecord, error)

func (*Service) RemoveEndpoints

func (s *Service) RemoveEndpoints(ctx context.Context, t traffic.Interface) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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