Giter Site home page Giter Site logo

Comments (13)

stv0g avatar stv0g commented on May 27, 2024 1

@ashellunts I think this might interest you.

from ice.

ashellunts avatar ashellunts commented on May 27, 2024 1

If peer A is behind NAT and peer B is not, that should work.

If both peers are behind NAT, server reflexive is needed, which is not supported.

from ice.

ashellunts avatar ashellunts commented on May 27, 2024

Hi @joshua-kim,

server reflexive TCP candidates are not supported. Only host ones.

Can you describe what is your use case? Can NAT1To1IPs help you?

from ice.

stv0g avatar stv0g commented on May 27, 2024

Server reflexive TCP candidates are not supported. Only host ones.

Just wondering, is this even possible/reasonable to implement support for Active/Passive TCP types?
Or is the SimultaneousOpen TCP type better suited here?

Here are the relevant parts of the RFCs:

@ashellunts Do our Passive TCP candidates only accept connections from known remote active TCP candidates? Are we checking their source IP/port when accepting the connections?

from ice.

joshua-kim avatar joshua-kim commented on May 27, 2024

Hi @joshua-kim,
server reflexive TCP candidates are not supported. Only host ones.
Can you describe what is your use case? ...

I'm aware that for some reason it's much more difficult to support connections over TCP than over UDP (although to be honest I'm not sure why, I definitely need to research this more). Our use case is that we work on avalanchego which is a p2p blockchain network.

Currently nodes can only connect to each other assuming they're publicly discoverable + not behind a stateful firewall. Ideally, we'd like to support nodes connecting to each other via a STUN server in the case that one of them wants to sit behind a NAT.

... Can NAT1To1IPs help you?

My understanding is that you can pass in some hard-coded ips that will act as candidates to connect to? If this is the case I don't think this will work if two nodes which are both behind their own NATs want to connect to each other, as I think we need a publicly discoverable STUN server to mediate the connection.

from ice.

joshua-kim avatar joshua-kim commented on May 27, 2024

Yeah we'd like to ideally support both peers behind a NAT! I know active tcp was only just merged in but just leaving this here as a feature request ^_^. As an aside I don't think this is a bug, I think we can remove the bug label here!

from ice.

ashellunts avatar ashellunts commented on May 27, 2024

@ashellunts Do our Passive TCP candidates only accept connections from known remote active TCP candidates? Are we checking their source IP/port when accepting the connections?

Agent accepts connections from any remote address and marks them as remote peer reflexive active candidate.
At the moment if an agent receives remote TCP active candidate, it ignores it, because it can't use it for initiating connections.

Though it can store it and use it for pair matching. For example to differentiate host and peer reflexive active candidates.

from ice.

ashellunts avatar ashellunts commented on May 27, 2024

Just wondering, is this even possible/reasonable to implement support for Active/Passive TCP types?
Or is the SimultaneousOpen TCP type better suited here?

@stv0g Do you mean for server reflexive type? Per standard active/passive and simultaneous-open are possible. Which one is better I don't know.

from ice.

stv0g avatar stv0g commented on May 27, 2024

@stv0g Do you mean for server reflexive type? Per standard active/passive and simultaneous-open are possible. Which one is better I don't know.

Yes for server reflexive.. As those candidates are usually used when a NAT-box is in use which block incoming TCP connection attempts. In my understanding simultaneous open could work around that.

But thats just an assumption based on what we usually see in real-world networks. In theory there could be still 1:1 NATs, or NATs which allow incoming TCP connections. So it surely would make sense to also generate passive TCP server reflexive candidates.. I just think that they have a low likelyhood of been selected.

from ice.

ashellunts avatar ashellunts commented on May 27, 2024

Our use case is that we work on avalanchego which is a p2p blockchain network.

@joshua-kim why do you need TCP for your use case?
So you would like to connect 2 nodes with reliable connection? Have you considered webrtc datachannel? It will be reliable connection and works over UDP.

from ice.

joshua-kim avatar joshua-kim commented on May 27, 2024

I probably should have mentioned this earlier but we don't use webrtc at all, we have a custom networking protocol we build on top of TCP and we were just hoping to use pion/ice's ice implementation on top of it to connect nodes behind NATs since pion/ice conveniently implements ice discovery over udp/tcp.

I'm aware that pion/ice was built for pion/webrtc in mind however (although to be honest I'm not really knowledgable in webrtc at all) so I totally understand that this is really outside of the typical use case of this library.

As you mentioned we do use TCP for reliable in-order messages, although I understand you can implement this on top of UDP similar to how webrtc datachannel does like you mentioned. I guess we could consider incorporating webrtc into our application based but it's definitely something I need to research more on since it's definitely something I'm not knowledgeable about, or trying to migrate to something built on top of UDP.

from ice.

ashellunts avatar ashellunts commented on May 27, 2024

I am not an expert, but I think TCP hole punching does not have high success rates.
In RFC it is written about 45% success rate, but that is data from 2005. https://datatracker.ietf.org/doc/html/rfc6544#appendix-A

from ice.

joshua-kim avatar joshua-kim commented on May 27, 2024

Hmm thanks for the read, had no idea that it was that bad. We're probably going to abandon this feature on our end for now unless we can migrate to something UDP based in the future.... apologies if I wasted anyone's time!

from ice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.