kit: Index | Files

package dnssrv

import ""

Package dnssrv provides an Instancer implementation for DNS SRV records.


Package Files

doc.go instancer.go lookup.go

type Instancer Uses

type Instancer struct {
    // contains filtered or unexported fields

Instancer yields instances from the named DNS SRV record. The name is resolved on a fixed schedule. Priorities and weights are ignored.

func NewInstancer Uses

func NewInstancer(
    name string,
    ttl time.Duration,
    logger log.Logger,
) *Instancer

NewInstancer returns a DNS SRV instancer.

func NewInstancerDetailed Uses

func NewInstancerDetailed(
    name string,
    refresh *time.Ticker,
    lookup Lookup,
    logger log.Logger,
) *Instancer

NewInstancerDetailed is the same as NewInstancer, but allows users to provide an explicit lookup refresh ticker instead of a TTL, and specify the lookup function instead of using net.LookupSRV.

func (*Instancer) Deregister Uses

func (s *Instancer) Deregister(ch chan<- sd.Event)

Deregister implements Instancer.

func (*Instancer) Register Uses

func (s *Instancer) Register(ch chan<- sd.Event)

Register implements Instancer.

func (*Instancer) Stop Uses

func (p *Instancer) Stop()

Stop terminates the Instancer.

type Lookup Uses

type Lookup func(service, proto, name string) (cname string, addrs []*net.SRV, err error)

Lookup is a function that resolves a DNS SRV record to multiple addresses. It has the same signature as net.LookupSRV.

Package dnssrv imports 6 packages (graph). Updated 2018-02-07. Refresh now. Tools for package owners.