realmdns

package module
v0.0.0-...-c7a50ff Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

README

Real mDNS

Name

Real mDNS - CoreDNS plugin that reads mDNS records from the local network and responds to queries based on those records.

Description

Useful for providing mDNS records to non-mDNS-aware applications by making them accessible through a standard DNS server.

Syntax

realmdns [bind address]

Examples

local.:53 {
    realmdns
}

And test with dig:

dig @localhost test.local

;; ANSWER SECTION:
test.local. 60 IN A   12.0.0.24
test.local. 60 IN AAAA fe80::f816:3eff:fe49:19b3

If minimum SRV records is specified in the configuration, the plugin will wait until it has at least that many SRV records before responding with any of them. minimum SRV records defaults to 3.

example.com {
    mdns example.com 2
}

This would mean that at least two SRV records of a given type would need to be present for any SRV records to be returned. If only one record is found, any requests for that type of SRV record would receive no results.

If filter text is specified in the configuration, the plugin will ignore any mDNS records that do not include the specified text in the service name. This allows the plugin to be used in environments where there may be mDNS services advertised that are not intended for use with it. When filter text is not set, all records will be processed.

example.com {
    mdns example.com 3 my-id
}

This configuration would ignore any mDNS records that do not contain the string "my-id" in their service name.

If bind address is specified in the configuration, the plugin will only send mDNS traffic to the associated interface. This prevents sending multicast packets on interfaces where that may not be desirable. To use bind address without setting a filter, set filter text to "".

example.com {
    mdns example.com 3 "" 192.168.1.1
}

This configuration will only send multicast packets to the interface assigned the 192.168.1.1 address. The interface lookup is dynamic each time an mDNS query is sent, so if the address moves to a different interface the plugin will automatically switch to the new one.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MDNS

type MDNS struct {
	Next plugin.Handler
	// contains filtered or unexported fields
}

func (MDNS) Name

func (mdns MDNS) Name() string

func (MDNS) ReplaceDomain

func (mdns MDNS) ReplaceDomain(input string) string

func (MDNS) ServeDNS

func (mdns MDNS) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error)

type ResponsePrinter

type ResponsePrinter struct {
	dns.ResponseWriter
}

func NewResponsePrinter

func NewResponsePrinter(w dns.ResponseWriter) *ResponsePrinter

func (*ResponsePrinter) WriteMsg

func (r *ResponsePrinter) WriteMsg(res *dns.Msg) error

Jump to

Keyboard shortcuts

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