@@ -189,7 +189,7 @@ func (g *Gateway) Listen(ctx context.Context) error {
189
189
190
190
log .Printf ("Listener started on %s" , quicListener .Addr ())
191
191
192
- g .registerRelayIsActive (ctx , quicListener . Addr (). String (), errCh )
192
+ g .registerRelayIsActive (ctx , errCh )
193
193
194
194
log .Info ().Msg ("Gateway started successfully" )
195
195
@@ -326,7 +326,7 @@ func (g *Gateway) createPermissionForStaticIps(staticIps string) error {
326
326
return nil
327
327
}
328
328
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 {
330
330
ticker := time .NewTicker (15 * time .Second )
331
331
maxFailures := 3
332
332
failures := 0
@@ -341,13 +341,7 @@ func (g *Gateway) registerRelayIsActive(ctx context.Context, addr string, errCh
341
341
return
342
342
case <- ticker .C :
343
343
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 )
351
345
if err != nil && ! strings .Contains (err .Error (), "tls:" ) {
352
346
failures ++
353
347
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
357
351
}
358
352
continue
359
353
}
360
- if conn != nil {
361
- defer conn .CloseWithError (0 , "All good" )
362
- }
363
354
}
364
355
}
365
356
}()
0 commit comments