Holepunch tester working?

Former-commit-id: e5977013b0
This commit is contained in:
Owen
2025-12-01 17:44:23 -05:00
parent 6e4ec246ef
commit a497f0873f
2 changed files with 198 additions and 16 deletions

View File

@@ -419,6 +419,7 @@ func StartTunnel(config TunnelConfig) {
config.Holepunch && !config.DisableRelay, // Enable relay only if holepunching is enabled and DisableRelay is false
middleDev,
interfaceIP,
sharedBind, // Pass sharedBind for holepunch testing
)
peerManager = peers.NewPeerManager(dev, peerMonitor, dnsProxy, interfaceName, privateKey)
@@ -432,9 +433,20 @@ func StartTunnel(config TunnelConfig) {
return
}
// Add holepunch monitoring for this endpoint if holepunching is enabled
if config.Holepunch {
peerMonitor.AddHolepunchEndpoint(site.SiteId, site.Endpoint)
}
logger.Info("Configured peer %s", site.PublicKey)
}
peerMonitor.SetHolepunchStatusCallback(func(siteID int, endpoint string, connected bool, rtt time.Duration) {
// This callback is for additional handling if needed
// The PeerMonitor already logs status changes
logger.Info("+++++++++++++++++++++++++ holepunch monitor callback for site %d, endpoint %s, connected: %v, rtt: %v", siteID, endpoint, connected, rtt)
})
peerMonitor.Start()
// Set up DNS override to use our DNS proxy