kit: Index | Files

package dnssrv

import ""

Package dnssrv provides a subscriber implementation for DNS SRV records.


Package Files

doc.go lookup.go subscriber.go

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.

type Subscriber Uses

type Subscriber struct {
    // contains filtered or unexported fields

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

func NewSubscriber Uses

func NewSubscriber(
    name string,
    ttl time.Duration,
    factory sd.Factory,
    logger log.Logger,
) *Subscriber

NewSubscriber returns a DNS SRV subscriber.

func NewSubscriberDetailed Uses

func NewSubscriberDetailed(
    name string,
    refresh *time.Ticker,
    lookup Lookup,
    factory sd.Factory,
    logger log.Logger,
) *Subscriber

NewSubscriberDetailed is the same as NewSubscriber, 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 (*Subscriber) Endpoints Uses

func (p *Subscriber) Endpoints() ([]endpoint.Endpoint, error)

Endpoints implements the Subscriber interface.

func (*Subscriber) Stop Uses

func (p *Subscriber) Stop()

Stop terminates the Subscriber.

Package dnssrv imports 7 packages (graph). Updated 2017-03-07. Refresh now. Tools for package owners.