-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Service discovery example #6
Comments
I haven't specifically tested SSH advertising, but in general the TXT advertising has worked. Can you post your registration code for the SSH service? |
I tried a few things, but I definitely have the feeling of not knowing enough about mDNS to make good guesses. Here's one iteration: domain = "nerves.local"
Mdns.Server.add_service(%Mdns.Server.Service{
domain: domain,
data: :ip,
ttl: 120,
type: :a
})
Mdns.Server.add_service(%Mdns.Server.Service{
domain: domain,
data: "_ssh._tcp.local",
ttl: 120,
type: :txt
}) |
can you try making |
That was my first try. |
hmm, did you try using the built-in client?
anything with that? |
also, you are starting the server as well?
|
after looking at the code, it may be necessary to pass the domain.
|
Specifically, this line https://github.com/rosetta-home/mdns/blob/master/lib/mdns/server.ex#L106 I'm not sure that is at all necessary. |
This is what I've figured out today. Just an ssh service discovery. [
# 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) Also, there is pending PR with a working example: nerves-project-attic/nerves_init_gadget#62 Move the domain problem here: #7 |
I had dig this problem for a while, and here is a example of service record.
Note the the list will work well
but the string will throw an exception
There is still a problem in the L106. When the domain was set to a list, it's doesn't match the right side Then you can use |
I'd like to advertise an
ssh
service so that a laptop running on the same LAN can discover the device. I've triedavahi-browse _ssh._tcp
on my Linux laptop and made several attempts with registering a service. Is there an example somewhere on how to do this? or something similar that I could modify? I saw that you could register PTR and TXT records in the readme, but my attempts to use those have failed.The text was updated successfully, but these errors were encountered: