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
[SPIKE] p2p communication channel #1441
Comments
After more thinking I would first suggest that we try to implement it with gRPC which already uses Protobuf. gRPC uses HTTP/2 with compressed headers and supports needed features like auth, retries out of the box. Also If we use gRPC we can start using it to call services like Accountant and Quality Oracle. |
Requirements
gRPC over HTTP/2 looks to be viable option @anjmao suggested. I would go for it. Any other suggestions? |
One major issue I see with gRPC over HTTP/2 its that it is TCP only. Meaning it will be ok for our tunnel based services, but will not work for services that are not tunnel based. My suggestion is to start looking at such transports as QUIC and/or HTTP/3. Currently grpc-go does not support QUIC, but there is such project: https://github.com/lucas-clemente/quic-go Any1 wants to experiment with that and see if we would be able to hook gRPC over quick? Reminder why we need UDP: its we only way to have a decent nat hole punching, thus services behind the nat. |
Yes, I looked more at gRPC too, and it looks that for our case it may not fit as it fit mostly client / server . We need something similar to https://github.com/perlin-network/noise which also know how to do other peers discovery by knowing only one peer (in case of multihop?) https://github.com/lucas-clemente/quic-go Looks interesting, but need to check how stable it as as development is in early stage. @zolia There is issue for gRPC over UDP grpc/grpc-go#241. Work is being done but nothing working yet. Could we use TCP for p2p messages and UDP proxy? I imagine we could adjust our UDP proxy to support transferring UDP packets TCP quite easy. |
Packets yes, but not tcp establishment itself. UDP proxy sets up "UDP session" which is not full blown tunnel by itself. You cannot simply establish TCP through it. That requires L3 tunnel. One way for us is to alway establish tunnel (maybe WG, maybe GRE without encryption), but that would limit portability and flexibility. With quic or any other udp based protocol, we can pre-punch UDP hole and setup that session on such hole. UPDATE: |
Ok so there are two cases.
So it looks like quic is the most promising which will work in both cases. |
Done in #1797 |
Motivation
There are many cases when we are / will be doing peer-to-peer communication after establishing session between two peers: payment promises, session keep-alives, session disconnects (after tunnel setup, broker may become unreachable), additional monitoring and performance testing services.
Such direct communication also leads to better decentralization. Also this will not increase broker load.
Implementation
Depending on what service is used, communication channel may need additional message encryption. For openvpn and wireguard services we don't need additional encryption.
AC: Messages that are p2p after session is established should be reworked to use such direct communication.
One way to implement such p2p communication is to use plain tcp session with protobuf. This way we reduce overhead introduced by http protocol headers and improve speed.
The text was updated successfully, but these errors were encountered: