mdns

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: MIT Imports: 11 Imported by: 0

README

mdns

Multicast DNS listener

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Debug controls the level of logging in module. By default the module is silent.
	// Set Debug to true to see module logs.
	Debug bool

	// ErrInvalidChannel nil channel passed for notification
	ErrInvalidChannel = errors.New("invalid channel")
)

Functions

func PrintServices added in v1.1.0

func PrintServices()

PrintServices log the services table

Types

type Entry

type Entry struct {
	IPv4  net.IP
	IPv6  net.IP
	Name  string
	Model string
	// contains filtered or unexported fields
}

Entry contains a full record of a mDNS entry

Simplified mdns entry to show the record by IPv4

func (*Entry) String added in v1.1.0

func (e *Entry) String() string

String return a simple Entry string

type Handler

type Handler struct {
	sync.Mutex // anonymous
	// contains filtered or unexported fields
}

Handler provides a query interface that can be used to search for service providers using mDNS

func NewHandler

func NewHandler(nic string) (c *Handler, err error)

NewHandler creates an IPv4 Multicast DNS handler for a given interface It will also attempt to create an IPv6 port if available.

func (*Handler) AddNotificationChannel

func (c *Handler) AddNotificationChannel(notification chan<- Entry) error

AddNotificationChannel set the channel for notifications

func (*Handler) ListenAndServe

func (c *Handler) ListenAndServe(ctx context.Context) error

ListenAndServe is the main loop to listen for MDNS packets.

func (*Handler) PrintTable

func (c *Handler) PrintTable()

PrintTable log the printer table

func (*Handler) QueryAll added in v1.1.0

func (c *Handler) QueryAll() error

QueryAll send a mdns discovery packet plus a mdns query for each active service on the LAN

func (*Handler) SendQuery added in v1.1.0

func (c *Handler) SendQuery(service string) error

SendQuery is used to send a multicast a query

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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