What circumstances dictate when direct dial is available through hole punching?

Hi all,

I’ve been experimenting with libp2p and NAT traversal using hole punching. In my code, I am using two NATted nodes, which have a TCP and QUIC transport. I am using peer discovery using the standard bootstrappers and relay through the standard static relays. I also set up an EventTracer in my code to see the Hole Punch Events as they occur. I notice that sometimes, I get a DirectDialEvent registered, but most of the time, I get a StartHolePunch, HolePunchAttempt and EndHolePunch events, in that order. Can someone help me understand what this means? If I get a DirectDialEvent, does this mean that my traffic passes directly into the other node without a relay connection? What circumstances have to happen for this to occur? And if I get Start, Attempt, and End events, does this mean that my traffic is passing through the relay before getting to the other node? I’ve been trying to understand the source code for this, but it’s way above my level for the moment, so any information about this will be greatly appreciated. Thanks.