mdns

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2021 License: MIT Imports: 10 Imported by: 1

README


Pion mDNS

A Go implementation of mDNS

Pion mDNS Slack Widget
Build Status GoDoc Coverage Status Go Report Card


Go mDNS implementation. The original user is Pion WebRTC, but we would love to see it work for everyone.

Running Server

For a mDNS server that responds to queries for pion-test.local

go run examples/server/main.go 

Running Client

To query using Pion you can run the query example

go run examples/query/main.go

You can use the macOS client

dns-sd -q pion-test.local

Or the avahi client

avahi-resolve -a pion-test.local

References

https://tools.ietf.org/html/rfc6762 https://tools.ietf.org/id/draft-ietf-rtcweb-mdns-ice-candidates-02.html

Community

Pion has an active community on the Golang Slack. Sign up and join the #pion channel for discussions and support. You can also use Pion mailing list.

We are always looking to support your projects. Please reach out if you have something to build!

If you need commercial support or don't want to use public methods you can contact us at team@pion.ly

Contributing

Check out the contributing wiki to join the group of amazing people making this project possible:

License

MIT License - see LICENSE for full text

Documentation

Overview

Package mdns implements mDNS (multicast DNS)

Index

Constants

View Source
const (
	// DefaultAddress is the default used by mDNS
	// and in most cases should be the address that the
	// net.Conn passed to Server is bound to
	DefaultAddress = "224.0.0.0:5353"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// QueryInterval controls how often we sends Queries until we
	// get a response for the requested name
	QueryInterval time.Duration

	// LocalNames are the names that we will generate answers for
	// when we get questions
	LocalNames []string

	LoggerFactory logging.LoggerFactory
}

Config is used to configure a mDNS client or server.

type Conn

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

Conn represents a mDNS Server

func Server

func Server(conn *ipv4.PacketConn, config *Config) (*Conn, error)

Server establishes a mDNS connection over an existing conn

func (*Conn) Close

func (c *Conn) Close() error

Close closes the mDNS Conn

func (*Conn) Query

func (c *Conn) Query(ctx context.Context, name string) (dnsmessage.ResourceHeader, net.Addr, error)

Query sends mDNS Queries for the following name until either the Context is canceled/expires or we get a result

func (*Conn) ReverseLookup

func (c *Conn) ReverseLookup(ctx context.Context, ip net.IP) (dnsmessage.ResourceHeader, string, error)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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