libp2p / rust-libp2p

The Rust Implementation of the libp2p networking stack.
https://libp2p.io
MIT License
4.3k stars 891 forks source link

mDNS: emit `ToSwarm::NewExternalAddrOfPeer` #5104

Open thomaseizinger opened 5 months ago

thomaseizinger commented 5 months ago

Description

With https://github.com/libp2p/rust-libp2p/pull/4371 merged, we have the foundation of https://github.com/libp2p/rust-libp2p/issues/4302 implemented.

libp2p-mdns needs to be extended to emit this new event whenever it discovers a new address via mDNS.

Motivation

Other behaviours should be able to learn the addresses discovered by mDNS.

Current Implementation

Only mDNS knows about its discovered addresses.

Are you planning to do it yourself in a pull request ?

No

1010adigupta commented 5 months ago

would like to work on this

justcode740 commented 4 months ago

would like to take this one once previous one time out. @thomaseizinger , unsure the policy here.

thomaseizinger commented 4 months ago

Feel free to start! :)

I've not heard from @1010adigupta so far.

justcode740 commented 4 months ago

Feel free to start! :)

I've not heard from @1010adigupta so far.

ah, ok, just afraid there's some duplicated work done.

1010adigupta commented 4 months ago

You can go for it, I got busy with some other stuff, didn't got time for this :)

justcode740 commented 4 months ago

@thomaseizinger hey i have a question, isn't the mDNS service already inform Swarm when a new peer discovered? https://github.com/libp2p/rust-libp2p/blob/master/protocols/mdns/src/behaviour.rs#L351, what need to change here?

thomaseizinger commented 4 months ago

It emits an mDNS specific event that the user has to react to manually. The idea of the new event is that it is shared with other behaviours.