Skip to content

Commit 3986df8

Browse files
authored
Merge pull request #3214 from akhilmhdh/fix/gateway-cert-error
feat: changed to permission check
2 parents 3fcd84b + 29e39b5 commit 3986df8

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

cli/packages/gateway/gateway.go

+3-12
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ func (g *Gateway) Listen(ctx context.Context) error {
189189

190190
log.Printf("Listener started on %s", quicListener.Addr())
191191

192-
g.registerRelayIsActive(ctx, quicListener.Addr().String(), errCh)
192+
g.registerRelayIsActive(ctx, errCh)
193193

194194
log.Info().Msg("Gateway started successfully")
195195

@@ -326,7 +326,7 @@ func (g *Gateway) createPermissionForStaticIps(staticIps string) error {
326326
return nil
327327
}
328328

329-
func (g *Gateway) registerRelayIsActive(ctx context.Context, addr string, errCh chan error) error {
329+
func (g *Gateway) registerRelayIsActive(ctx context.Context, errCh chan error) error {
330330
ticker := time.NewTicker(15 * time.Second)
331331
maxFailures := 3
332332
failures := 0
@@ -341,13 +341,7 @@ func (g *Gateway) registerRelayIsActive(ctx context.Context, addr string, errCh
341341
return
342342
case <-ticker.C:
343343
log.Debug().Msg("Performing relay connection health check")
344-
ctxTimeout, cancel := context.WithTimeout(ctx, 5*time.Second)
345-
defer cancel()
346-
// Try to establish a QUIC connection
347-
conn, err := quic.DialAddr(ctxTimeout, addr, &tls.Config{
348-
InsecureSkipVerify: false, // Skip certificate verification
349-
NextProtos: []string{"infisical-gateway"},
350-
}, nil)
344+
err := g.createPermissionForStaticIps(g.config.InfisicalStaticIp)
351345
if err != nil && !strings.Contains(err.Error(), "tls:") {
352346
failures++
353347
log.Warn().Err(err).Int("failures", failures).Msg("Failed to refresh TURN permissions")
@@ -357,9 +351,6 @@ func (g *Gateway) registerRelayIsActive(ctx context.Context, addr string, errCh
357351
}
358352
continue
359353
}
360-
if conn != nil {
361-
defer conn.CloseWithError(0, "All good")
362-
}
363354
}
364355
}
365356
}()

0 commit comments

Comments
 (0)