dns

package
v0.64.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSRVRecord

func ParseSRVRecord(rec string) (srv, proto, name string, err error)

ParseSRVRecord returns the different elements of SRV records by parsing rec string.

Types

type SRVResolver

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

SRVResolver performs SRV resolution and optionally runs those in background sending periodical updates.

func NewSRVResolver

func NewSRVResolver(
	service string,
	proto string,
	name string,
	resolveInterval time.Duration,
	logger log.Logger,
) *SRVResolver

NewSRVResolver creates and initializes a new SRVResolver instance.

func (*SRVResolver) Close

func (r *SRVResolver) Close()

Close stops running SRV resolution.

func (*SRVResolver) Resolve

func (r *SRVResolver) Resolve(ctx context.Context) error

Resolve performs SRV resolution and starts running background updates.

func (*SRVResolver) Targets

func (r *SRVResolver) Targets() []string

Targets returns last resolved SRV targets.

func (*SRVResolver) Update

func (r *SRVResolver) Update() <-chan SRVUpdate

Update returns the SRV record updates channel.

type SRVUpdate

type SRVUpdate struct {
	// NewTargets contains the set of new targets compared to previous resolution.
	NewTargets []string

	// OldTargets contains the set of removed targets compared to previous resolution.
	OldTargets []string
}

SRVUpdate represents an SRV resolution update.

Jump to

Keyboard shortcuts

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