mdns

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package `mdns` implements a multicast DNS client and server to be used to discover and register services over local networks

Index

Constants

View Source
const (
	DefaultName  = "mdns"
	DefaultLabel = "local"
)

Variables

This section is empty.

Functions

func NewWithPlugin added in v1.1.3

func NewWithPlugin(p Plugin) (*mdns, error)

Create a new logger task with provider of other tasks

Types

type EventType

type EventType uint
const (
	None EventType = iota
	Receive
)

func (EventType) String

func (t EventType) String() string

type Message added in v1.1.3

type Message interface {
	PTR() []Ptr             // Return PTR records
	A() []net.IP            // Return A records
	TXT() []string          // Return TXT records
	SRV() []Srv             // Return SRV records
	Bytes() ([]byte, error) // Return the packed message
	IsAnswer() bool         // Return true when the message is an answer
	IfIndex() int           // Interface to send and receive on, or nil
}

A sent or received message

func MessageFromPacket added in v1.1.3

func MessageFromPacket(packet []byte, sender net.Addr, iface net.Interface) (Message, error)

Create a message from a received packet, with a sender and the interface that the message was received on

func MessageWithQuestion added in v1.1.3

func MessageWithQuestion(question string, iface net.Interface) (Message, error)

Create a message from a question, to be sent on a specific interface or on all interfaces if the index is zero

type Plugin added in v1.1.3

type Plugin struct {
	task.Plugin
	Interface string `json:"interface,omitempty"`
}

func WithLabel added in v1.1.3

func WithLabel(label string) Plugin

func (Plugin) Interfaces added in v1.1.3

func (p Plugin) Interfaces() ([]net.Interface, error)

func (Plugin) Label added in v1.1.3

func (p Plugin) Label() string

func (Plugin) Name added in v1.1.3

func (p Plugin) Name() string

func (Plugin) New added in v1.1.3

Create a new logger task with provider of other tasks

type Ptr added in v1.1.3

type Ptr interface {
	Service() string    // Return service
	Name() string       // Return name
	TTL() time.Duration // Return time-to-live for record
}

type Srv added in v1.1.3

type Srv interface {
	Host() string     // Return host
	Port() uint16     // Return port
	Priority() uint16 // Return priority
}

Jump to

Keyboard shortcuts

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