-
Notifications
You must be signed in to change notification settings - Fork 250
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
Future of mDNS discovery #28
Comments
I like the proposal (as we sync'ed up) to use the TXT record as a store for |
I much prefer Do not like the idea of port 0 in a SRV record. Why not 4001? Or do we need to even publish a SRV record? Why not just publish an A and TXT record. |
Because its not always 4001. It could be something else, or multiple something elses. |
I totally agree but... I'm worried that spec compliant libraries will simply ignore invalid records. SRV records require "names" to be of the form
It's required by the mDNS spec, unfortunately.
Really, we only care about the TXT record and the PTR record. Unfortunately, the go libraries, at least, choke when there are no A/AAAA records present.
The spec very explicitly states that the TXT record should generally only be used for legacy systems and hints and that it absolutely MUST NOT duplicate any information from the SRV record (port/hostname). |
@Stebalien I agree with your comments. So a question for an ipfs service will have NAME = "_ipfs._upd.local". What about CLASS and TYPE? Perhaps?
|
@Stebalien more bike shedding Since we are trying to replace |
@richardschneider Ideally, we'd announce both. |
@richardschneider it would be genius if you could compile the results of this issue into a small spec to libp2p/specs that all implementations can follow. |
It's been on my todo list to write some notes on MDNS, I will add it to libp2p/specs (real soon). TXT record I suggest we go back to generating A/AAAA records and have the peer synthesize the multiaddres. |
@diasdavid can you grant me access to 'https://github.com/libp2p/specs.git/'. I have a spec ready for review (minus working examples). |
@richardschneider you got it :) |
An important factor, we either have to bind 5353 for mDNS using SO_REUSEPORT to allow system mDNS daemon to work. Also, it would be nice if we used system specific servers/resolvers but it could be problematic. |
Unfortunately, that won't work as only one application will receive the packets. Really, we need to register with the OS (Avahi, windows, etc.). |
I'm not sure that's true. My Rust prototype (libp2p/rust-libp2p#590) "just works". I can start it multiple times in addition to sniffing applications, without any issue. |
Apparently, you're right. Multicast packets are delivered to all listeners on a port. Although, apparently, we need to be careful about sending responses to specific IP addresses ("QU responses"). |
After spending way too much time trying to figure out how to follow the semantics mDNS spec, I've come to the conclusion that, in light of our multiaddr system, it's probably not worth it. So, my proposal is to ignore the port/ip addresses and duplicate this information in the TXT field (flagrantly violating the spec).
Requirements
Current State
js-ipfs
ipfs.local
while the spec requires_$service._$proto.local
where$service
can be anything (but the_
prefix is strongly suggested) and$proto
must betcp
orudp
(whereudp
is just a catch-all for everything else). This is a requirement of the SRV spec and we probably shouldn't be violating it.go-ipfs
_ipfs-discovery._udp.local
. We're not announcing the discovery service, we're announcing the ipfs service.Proposal
First, we need to specify the Instance, ServiceName, Proto, and TLD fields (for mDNS).
The constraints are:
.local
(for link-local mDNS, at least)._udp
or_tcp
for legacy reasons. As_udp
is treated as the "catch all" we should use that.I propose:
_ipfs
. This is inconsistent with both js and go but obeys the spec (starts with an underscore, names the actual service we care about). Also, using a different service name will provide us a clean break between new and old nodes._udp
. We need something and_udp
appears to be the catch all.Second, we will need to at least specify a set of IPs and ports.
Third, we need to specify the multiaddrs somewhere. I'd like to reuse
dnsaddr
for this. That is, for each multiaddr, attach a TXT record of the formdnsaddr=/full/multiaddr
.Finally, we need to put a reasonable hostname in the A/AAAA and SRV records. We could continue putting in the local hostname but I'd kind of like to use
QmId.ipfs.local
(it's not the job of ipfs to broadcast the hostname to the network). Will that cause any problem)?@whyrusleeping, @diasdavid, @richardschneider thoughts?
The text was updated successfully, but these errors were encountered: