feat: resolved small gateway issues and added gateway uninstall command

This commit is contained in:
=
2025-03-23 22:24:41 +05:30
parent 4adf0aa1e2
commit 54b13a9daa
4 changed files with 81 additions and 15 deletions
+5 -2
View File
@@ -89,7 +89,7 @@ func (g *Gateway) ConnectWithRelay() error {
turnClientCfg.Conn = turn.NewSTUNConn(conn)
} else {
log.Info().Msgf("Provided relay port %s. Using non TLS connection.", relayPort)
conn, err := net.ListenPacket("udp4", turnAddr.String())
conn, err := net.ListenPacket("udp4", "0.0.0.0:0")
if err != nil {
return fmt.Errorf("Failed to connect with relay server: %w", err)
}
@@ -342,7 +342,9 @@ func (g *Gateway) registerRelayIsActive(ctx context.Context, errCh chan error) e
case <-ticker.C:
log.Debug().Msg("Performing relay connection health check")
err := g.createPermissionForStaticIps(g.config.InfisicalStaticIp)
if err != nil && !strings.Contains(err.Error(), "tls:") {
// try again error message from server happens to avoid congestion
// https://github.com/pion/turn/blob/master/internal/client/udp_conn.go#L382
if err != nil && !strings.Contains(err.Error(), "try again") {
failures++
log.Warn().Err(err).Int("failures", failures).Msg("Failed to refresh TURN permissions")
if failures >= maxFailures {
@@ -351,6 +353,7 @@ func (g *Gateway) registerRelayIsActive(ctx context.Context, errCh chan error) e
}
continue
}
failures = 0 // reset
}
}
}()