Giter VIP home page Giter VIP logo

mdns's Introduction


Pion mDNS

A Go implementation of mDNS

Pion mDNS Slack Widget
GitHub Workflow Status Go Reference Coverage Status Go Report Card License: MIT


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

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

go run examples/server/publish_ip/main.go -ip=[IP]

If you don't set the ip parameter, "1.2.3.4" will be used instead.

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

RFCs

Implemented

Roadmap

The library is used as a part of our WebRTC implementation. Please refer to that roadmap to track our major milestones.

Community

Pion has an active community on the Slack.

Follow the Pion Twitter for project updates and important WebRTC news.

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 [email protected]

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

mdns's People

Contributors

at-wat avatar bendahl avatar edaniels avatar hugoarregui avatar jonasberge avatar jpeletier avatar la3lma avatar nullvariable avatar pionbot avatar renovate-bot avatar renovate[bot] avatar sean-der avatar simonverkada avatar stv0g avatar sukunrt avatar trivigy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mdns's Issues

Querying does not work for cases when advertising is delegated to another host.

Your environment.

  • Version: v0.0.5
  • Browser: N/A
  • Other Information - N/A

What did you do?

I have a code that advertises A records on behalf of other hosts. Simple code to do that is (this code runs on a host with a different IP address):

package main

import (
	"github.com/davecheney/mdns"
	"fmt"
	"time"
)

func main() {
	err := mdns.Publish("test.local 60 IN A 10.0.1.0")
	if err != nil {
		panic(err)
	}
	fmt.Println("ok")
	time.Sleep(60 * time.Minute)
}

Then query it using code as in examples:

package main

import (
	"context"
	"fmt"
	"net"

	"github.com/pion/mdns"
	"golang.org/x/net/ipv4"
)

func main() {
	addr, err := net.ResolveUDPAddr("udp", mdns.DefaultAddress)
	if err != nil {
		panic(err)
	}

	l, err := net.ListenUDP("udp4", addr)
	if err != nil {
		panic(err)
	}

	server, err := mdns.Server(ipv4.NewPacketConn(l), &mdns.Config{})
	if err != nil {
		panic(err)
	}
	answer, src, err := server.Query(context.TODO(), "test.local")
	if err != nil {
		panic(err)
	}
	fmt.Println(answer)
	fmt.Println(src)
	fmt.Println(err)
}

What did you expect?

Querying using this library should work. It works using avahi client and it works using macos dns-sd. I expect that while the above code is running, querying using this library for "test.local" returns correct result.

What happened?

It hangs indefinitely.

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Unanswered queries are not cleaned up

Your environment.

  • Version: v0.0.9
  • Browser: --
  • Other Information - Conn.Query(...) should cleanup it's entry in c.queries when it returns. Otherwise, unanswered queries will remain in the slice, causing a memory leak.

What did you do?

Created mDNS server. Ran query for address which is not being advertised (at the moment the query is placed) with a 10 second timeout. Some time later, make another query. Rinse and repeat forever.

Server:

	destination := "my-destination"

	mdnsServer, err = mdns.Server(ipv4.NewPacketConn(l), &mdns.Config{
		LocalNames:   localNames,
		LocalAddress: localIP,
	})
	if err != nil {
		panic(err)
	}
 
	queryCtx, queryCancel := context.WithTimeout(context.Background(), 5*time.Second)
	defer queryCancel()
	answer, src, err := mdnsServer.Query(queryCtx, destination)
	if err != nil {
		panic(err)
	}
	// Use answer, src

What did you expect?

Expected the query to be cleared after the timeout expires.

What happened?

The queries map grows forever with unanswered queries, which hold a reference to a heap allocated channel. Since these are never cleared (until the server is stopped), this causes a memory leak in long-standing servers which make unanswered queries.

Does not work on Windows

What happened?

I am using Windows (11) and running the example programs does not work. I start the server and run dns-sd -q my-domain.local from another computer (macOS) and expect to receive a response from the Windows machine running the pion mDNS server. But I don't get anything. I see the mDNS packets coming through in Wireshark but the Go program does not seem to get them and therefore does not respond.

Error "mDNS: failed to join multicast group" on WSL in Windows

errJoiningMulticastGroup = errors.New("mDNS: failed to join multicast group")

mdns/conn.go

Line 66 in b37c5ea

return nil, errJoiningMulticastGroup

I am seeing this log message from the code fragment

import ( "github.com/pion/webrtc/v2" )
func doWebRTC() {
    _, err := webrtc.NewPeerConnection(webrtc.Configuration{})
    if err != nil {
        log.Println("error while starting RTC server:", err)
    }
}
go doWebRTC()

I am not sure what is causing it but I have seen it referenced in at least one other issue: pion/example-webrtc-applications#27

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.