mdns
mdns copied to clipboard
Resolve domain name
When I'm start a server with following records:
[
# create domain for an ip
%Mdns.Server.Service{domain: "somedomain.local", data: :ip, ttl: 450, type: :a},
# make service discoverable
%Mdns.Server.Service{domain: "_services._dns-sd._udp.local",data: "_ssh._tcp.local",ttl: 4500, type: :ptr},
# register ssh service
%Mdns.Server.Service{domain: "_ssh._tcp.local",data: "SOME NAME._ssh._tcp.local",ttl: 4500, type: :ptr},
# point service to our domain and port (22)
%Mdns.Server.Service{domain: "SOME NAME._ssh._tcp.local",data: {0,0,22, 'somedomain.local'},ttl: 4500,type: :srv},
# empty txt service (some tools expext that)
%Mdns.Server.Service{domain: "SOME NAME._ssh._tcp.local",data: [],ttl: 4500,type: :txt})
] |> Enum.each(&Mdns.Server.add_service/1)
Tools like Avahi Discovery, Avahi SSH Server Browse, mdns-scan works fine.
But when I'm trying to find device with Mdns.Client
the domain is nil
.
After a little research this condition https://github.com/rosetta-home/mdns/blob/master/lib/mdns/server.ex#L106 prevent to send :a
record witch Mdns.Client
is looking for. On the other side other tools resolve domain correctly.
Should Mdns.Server
always send :a
record od Mds.Client
should resolve domain in a different way?
I'm not sure, and haven't been using the library much, but I would love to resolve these issues.
Anyway you could provide a PR? I might be beneficial to fix it on both sides.