-
Notifications
You must be signed in to change notification settings - Fork 111
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
Add UDP #326
Comments
i know there has been some discussion on how to best unify tcp and udp under libp2p -- pinging @mgoelzer or @raulk for links to previous discussion |
|
I completely agree. We must think and discuss about it, before implementing it. (By the way, I just did the pull request for being easily referable the code, I did not have any intention for merging it right away) What do you mean by "how we should support it"? How would be best implemented? |
Yes. Sorry for being unclear. I meant how we should implement it. Which parts need modifying(Even though the other components are abstracted from the underlying transport, I guess we might encounter some issues when those components uses UDP transport.) |
I had a post asking about UDP support in libp2p forum. @bigs have a proposal for it. Since the discussion on the packet protocol is still ongoing, IMO it's nice to contribute to the proposal and we can implement it after things are settled. |
Hey folks, track and participate in the discussion by following the links on this epic: libp2p/specs#225 Thanks! |
Maybe it's interesting to note here that I have been thinking about how to reorganize libp2p's connection implimentation structure, for example, here is a quick diagram of how the current tree (partially) looks like in that regard, and I've made a theoretical implimentation diagram here of a new situation, this all ties into #228. The last diagram is still a draft, and already outdated (it's revealed through debate that (Opinion: Python is not Golang, and we shouldn't entirely rely on go-libp2p for examples, but instead work and live by the specs) |
I have made a first draft for implementing UDP in Transport Layer.
It is supposed to be implemented in Go, however master branch is empty. The only code we can find is in the second branch feat/udp.
So, my approach is not based at all in Go's "implementation". I propose a unified interface for UDP and TCP Streams: IStreamReader and IStreamWriter. Apart from getting a unified interface, I have also tried to keep it simple. Now, streams just implement four methods: get_extra_info, close, read and write. I may have made it too high-level abstracting from methods like drain or others. I let it for discussion ;)
It may look weird UDP implementing a Stream interface, however, in order to achieve modularity between transports, we must simulate a Session-like-stream on UDP. Due to this Unified Interface, every transport protocol will need to implement four interfaces: ITransport, IListener and IStreamReader and IStreamWriter. You can find the new Stream interfaces here: UDP Streams and TCP Streams. On the other hand, I think this two last interfaces could be gatherer into one interface, however, I have prefered to divide them, for being compatible with current RawConnection, Swarm....
Of course, this code is just a playeable implementation, intended for encouraging discussions and give a new perspective. I have not made any tests for UDP yet, even though, TCP passes current tests while implementing this new Unified Interface.
The text was updated successfully, but these errors were encountered: