Comments (13)
@ashellunts I think this might interest you.
from ice.
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.
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.
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:
- https://www.rfc-editor.org/rfc/rfc6544.html#section-5.2
- https://www.rfc-editor.org/rfc/rfc6544.html#appendix-B
- https://www.rfc-editor.org/rfc/rfc5389#section-7.2.2
@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.
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.
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 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.
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 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.
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.
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.
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.
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)
- Rename Agent.startOnConnectionStateChangeRoutine() to Agent.startRoutines() HOT 1
- Simplify Agent.updateConnectionState() HOT 1
- Reenable IPv6 UDPMux tests in i386
- Active TCP candidates? HOT 7
- Fix type of CandidatePairState enum
- TestAgentActiveTCP test is failing due to data race
- Active TCP performs network operations in main thread HOT 7
- Connection failing to TCP candidate when listening on multiple interfaces using `MultiTCPMux` and `NAT1To1IPs` HOT 5
- Noisy warnings if TURN/STUN host is not reachable via IPv6
- Panic when adding candidate HOT 5
- bug(log): webrtc using ice will print wrong log HOT 1
- ice v2 depends on transport v2.2.2, which had a breaking change HOT 1
- Candidate type is not changed from peer-reflexive to host HOT 1
- Allow users to pass custom 'CandidateSelectorControlling` and `CandidateSelectorControlled` HOT 3
- ConnectionState changes may be reported incorrectly HOT 4
- Please add a new release tag HOT 2
- Android 11 ListenUDP permission denine
- Support ipv6 for mDNS Server HOT 2
- Start the listening port by default above 1024 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ice.