pion / mdns Goto Github PK
View Code? Open in Web Editor NEWPure Go implementation of Multicast DNS
Home Page: https://pion.ly/
License: MIT License
Pure Go implementation of Multicast DNS
Home Page: https://pion.ly/
License: MIT License
I'm not much into mDNS, but I need to broadcast my IP to the local network, so Chrome can connect to my server in port 8080, but i'm not able to connect to it through "my-mdns.local:8080" and I can't set a default port to broadcast (if it makes sense).
What can I do? Is this a feature to be implemented?
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.
Please add ipv6 support
See https://rtcweb-wg.github.io/mdns-ice-candidates/mmusic/draft-ietf-mmusic-mdns-ice-candidates.html#implementation-guidance-1. It can help with security in addition to chattiness. I had implemented it in 17c664e but it was out of scope of the actual fix and I did not have a test to complement it. Also see https://datatracker.ietf.org/doc/html/draft-ietf-rtcweb-mdns-ice-candidates-04#section-3.2.1 point 2
Good reference at https://pkg.go.dev/golang.org/x/net/ipv4
Line 6 in 4f64fff
Line 66 in b37c5ea
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
I am currently using https://github.com/davecheney/mdns/ to advertise A record for another host. This is valid functionality according to mDNS specs
This supports use cases when the host that needs to be advertised is not capable of advertising itself (i.e. containers)
I am using https://github.com/davecheney/mdns/ for this, but that repo is archived and no longer maintained.
N/A
This issue provides visibility into Renovate updates and their statuses. Learn more
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
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.
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)
}
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.
It hangs indefinitely.
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.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
Expected the query to be cleared after the timeout expires.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.