libp2p/go-libp2p-kad-dht

Is the PING message type used?

JustinDrake opened this issue · 10 comments

I can see all the other message types (see dht.proto) being used (e.g. PUT_VALUE, GET_VALUE, etc.) but PING seems unused. I'm writing a DHT crawler and this PING message seems quite useful to know who is online, so I'm considering writing a wrapper function for it (similar to getValueSingle).

@JustinDrake We don't use it anymore, but the ipfs ping command used to use it. Ping is now a separate protocol. We can probably mark it as deprecated somehow (but removing things from protobufs is hard)

I think it makes sense to keep. Do we still have code that actually implements the ping message? Use case: a protocol being able to test itself. The ping protocol on the other hand is for testing the remote host.

@lgierth I think there's only code to handle incoming ping messages, but none implementing outgoing ping messages.

@JustinDrake We should probably use this ping message for the routing table stuff discussed in the other issue

The kadmelia specs says:

It would seem useful to add to the Contact data structure at least:

  • an RTT (round trip time) value or a set of such values, measured in ms
  • more IP addresses, together with perhaps
    • protocol used (TCP/IP, UDP)
    • NAT information, if applicable
    • whether the address is local and so reachable by broadcast

Adding an RTT or set of RTTs to the Contact data structure would enable better decisions to be made when selecting which to use.

The round trip time (RTT) to the contact could be as measured using a PING RPC or using a conventional Internet network ping.

bigs commented

we use TCP connections which makes this unnecessary in our current implementation[

Is PING mentioned in the spec?

The kademlia spec? Yes.

No, our spec.