Skip to content
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

fix the instance name used for the zeroconf server #1211

Closed
wants to merge 1 commit into from

Conversation

marten-seemann
Copy link
Contributor

Fixes #1207. Requesting a review from @mxinden, since this is more of a spec-compliance issue here than a coding issue.

The effect would be that the host name we use is not \018\ *\198*\229\139\238e\188..\002K?\172#\'\000\249LY\248<\177\131\ \246<\2081\154\009._p2p._udp.local., but Qmxxx._p2p._udp.local.

@mxinden
Copy link
Member

mxinden commented Sep 30, 2021

The peer name would need to be base-32 encoded, right?

See spec:

peer-name is the case-insensitive unique identifier of the peer, and is less than 64 characters. It is normally the base-32 encoding of the peer's ID.

https://github.com/libp2p/specs/blob/master/discovery/mdns.md#definitions

Logic that encodes a peer id in rust-libp2p, making sure it does not exceed the 63 byte max label length:

https://github.com/libp2p/rust-libp2p/blob/c13f03354b8ec179845df825afbddb6665decaba/protocols/mdns/src/dns.rs#L283-L297

In practice my peer with the peer ID 12D3KooWM72jxc25yR4sHYA25wFUP3k5STpwpzYvkGTYwsTgGxnV emits the following MDNS packet:

Frame 135: 522 bytes on wire (4176 bits), 522 bytes captured (4176 bits) on interface wlp3s0, id 0
Ethernet II, Src: IntelCor_8c:3e:b2 (84:fd:d1:8c:3e:b2), Dst: IPv4mcast_fb (01:00:5e:00:00:fb)
Internet Protocol Version 4, Src: 192.168.2.107, Dst: 224.0.0.251
User Datagram Protocol, Src Port: 34988, Dst Port: 5353
Multicast Domain Name System (response)
    Transaction ID: 0xbb4d
    Flags: 0x8400 Standard query response, No error
    Questions: 0
    Answer RRs: 1
    Authority RRs: 0
    Additional RRs: 2
    Answers
        _p2p._udp.local: type PTR, class IN, 009jj0820t9ccv5nw8hw82umphjc6dxxnqqt760hkfwcrmnmgc53vd0vzyu49._p2p._udp.local
            Name: _p2p._udp.local
            Type: PTR (domain name PoinTeR) (12)
            .000 0000 0000 0001 = Class: IN (0x0001)
            0... .... .... .... = Cache flush: False
            Time to live: 360 (6 minutes)
            Data length: 79
            Domain Name: 009jj0820t9ccv5nw8hw82umphjc6dxxnqqt760hkfwcrmnmgc53vd0vzyu49._p2p._udp.local
    Additional records
    [Request In: 134]
    [Time: 0.000419826 seconds]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

flaky mDNS test
2 participants