[proxy] Use UUID for proxy ID generation (#6391)

Use UUID for proxy ID instead of the second to avoid race conditions when running multiple nodes at the same time.
This commit is contained in:
Maycon Santos
2026-06-10 13:35:26 +02:00
committed by GitHub
parent e229050ba3
commit 61abf5b9ea

View File

@@ -24,6 +24,7 @@ import (
"time" "time"
"github.com/cenkalti/backoff/v4" "github.com/cenkalti/backoff/v4"
"github.com/google/uuid"
"github.com/pires/go-proxyproto" "github.com/pires/go-proxyproto"
prometheus2 "github.com/prometheus/client_golang/prometheus" prometheus2 "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/client_golang/prometheus/promhttp"
@@ -615,7 +616,7 @@ func (s *Server) initDefaults() {
// If no ID is set then one can be generated. // If no ID is set then one can be generated.
if s.ID == "" { if s.ID == "" {
s.ID = "netbird-proxy-" + s.startTime.Format("20060102150405") s.ID = fmt.Sprintf("netbird-proxy-%s", uuid.NewString())
} }
// Fallback version option in case it is not set. // Fallback version option in case it is not set.
if s.Version == "" { if s.Version == "" {