mdns

package
v0.0.0-...-0a06464 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResolver

func NewResolver(logger logger.Logger) nameresolution.Resolver

NewResolver creates the instance of mDNS name resolver.

Types

type Resolver

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

func (*Resolver) Close

func (m *Resolver) Close() error

Close is not formally part of the name resolution interface as proposed in https://github.com/dapr/components-contrib/issues/1472 but this is used in the tests to clean up the mDNS registration.

func (*Resolver) Init

func (m *Resolver) Init(metadata nameresolution.Metadata) error

Init registers service for mDNS.

func (*Resolver) ResolveID

func (m *Resolver) ResolveID(req nameresolution.ResolveRequest) (string, error)

ResolveID resolves name to address via mDNS.

type Subscriber

type Subscriber struct {
	AddrChan chan string
	ErrChan  chan error
}

func NewSubscriber

func NewSubscriber() Subscriber

func (*Subscriber) Close

func (s *Subscriber) Close()

type SubscriberPool

type SubscriberPool struct {
	Once        *sync.Once
	Subscribers []Subscriber
}

SubscriberPool is used to manage a pool of subscribers for a given app id. 'Once' belongs to the first subscriber as it is their responsibility to fetch the address associated with the app id and publish it to the other subscribers. WARN: pools are not thread safe and intended to be accessed only when using subMu lock.

func NewSubscriberPool

func NewSubscriberPool(w Subscriber) *SubscriberPool

func (*SubscriberPool) Add

func (p *SubscriberPool) Add(sub Subscriber)

Jump to

Keyboard shortcuts

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