mdns

package
v3.0.33 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: BSD-2-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EOF rune = -(iota + 1)
)

Variables

View Source
var (
	MULTICAST_ADDR_IPV4 = &net.UDPAddr{IP: net.ParseIP("224.0.0.251"), Port: 5353}
	MULTICAST_ADDR_IPV6 = &net.UDPAddr{IP: net.ParseIP("ff02::fb"), Port: 5353}
)
View Source
var (
	ErrParseError = errors.New("Parse Error")
)

Functions

func NewMsgEvent added in v3.0.3

func NewMsgEvent(msg *dns.Msg, addr net.Addr, ifIndex int) gopi.Event

func NewService added in v3.0.3

func NewService(zone string) *service

func NewServices added in v3.0.3

func NewServices(msg *dns.Msg, zone string) *services

Parse DNS message and capture service records

func NewTokenizer added in v3.0.3

func NewTokenizer(src string) *tokenizer

func Quote added in v3.0.3

func Quote(src string) string

func Unquote added in v3.0.3

func Unquote(src string) (string, error)

Unquote returns a bare string without quoted characters. The following Coversions happen: \\ \n \f \t \r Happen as normal \xFF returns a byte from hex \123 returns a byte from decimal \0123 returns a bype from octal

Types

type Discovery

type Discovery struct {
	gopi.Unit
	gopi.Publisher
	sync.WaitGroup
	gopi.Logger
	*Listener
	*Responder
}

func (*Discovery) EnumerateServices

func (this *Discovery) EnumerateServices(ctx context.Context) ([]string, error)

func (*Discovery) Lookup added in v3.0.3

func (this *Discovery) Lookup(ctx context.Context, srv string) ([]gopi.ServiceRecord, error)

func (*Discovery) ParseEmit added in v3.0.3

func (this *Discovery) ParseEmit(msg *dns.Msg) error

func (*Discovery) Run

func (this *Discovery) Run(ctx context.Context) error

type FuncRecordsForService added in v3.0.3

type FuncRecordsForService func(string) []gopi.ServiceRecord

FuncRecordsForService returns service records for named service

type FuncServices added in v3.0.3

type FuncServices func() []string

FuncServices returns fully-qualified service names

type Listener

type Listener struct {
	sync.RWMutex
	sync.WaitGroup
	gopi.Unit
	gopi.Logger
	gopi.Publisher
	// contains filtered or unexported fields
}

func (*Listener) AddrForIface added in v3.0.3

func (this *Listener) AddrForIface(ifIndex int, flags gopi.ServiceFlag) []net.IP

func (*Listener) Define

func (this *Listener) Define(cfg gopi.Config) error

func (*Listener) Dispose

func (this *Listener) Dispose() error

func (*Listener) New

func (this *Listener) New(cfg gopi.Config) error

func (*Listener) Run

func (this *Listener) Run(ctx context.Context) error

func (*Listener) Send

func (this *Listener) Send(msg *dns.Msg, ifIndex int) error

Send a DNS message to a particular interface or all interfaces if 0

func (*Listener) String

func (this *Listener) String() string

func (*Listener) Zone added in v3.0.3

func (this *Listener) Zone() string

type Responder added in v3.0.3

type Responder struct {
	gopi.Unit
	gopi.Publisher
	gopi.Logger
	sync.WaitGroup
	sync.RWMutex
	*Listener
	// contains filtered or unexported fields
}

func (*Responder) NewServiceRecord added in v3.0.3

func (this *Responder) NewServiceRecord(service string, name string, port uint16, txt []string, flags gopi.ServiceFlag) (gopi.ServiceRecord, error)

func (*Responder) ProcessQuestion added in v3.0.3

func (this *Responder) ProcessQuestion(msg *msgevent) error

func (*Responder) Records added in v3.0.3

func (this *Responder) Records(name string) []gopi.ServiceRecord

func (*Responder) Run added in v3.0.3

func (this *Responder) Run(ctx context.Context) error

func (*Responder) SendAnswers added in v3.0.7

func (this *Responder) SendAnswers(ifIndex int, msgs []*dns.Msg) error

func (*Responder) Serve added in v3.0.3

func (this *Responder) Serve(ctx context.Context, r []gopi.ServiceRecord) error

func (*Responder) Services added in v3.0.3

func (this *Responder) Services() []string

func (*Responder) SetServices added in v3.0.3

func (this *Responder) SetServices(r []gopi.ServiceRecord) error

Jump to

Keyboard shortcuts

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