Files
netbird/proxy/internal/proxy/context.go
2026-01-26 09:28:46 +00:00

25 lines
421 B
Go

package proxy
import (
"context"
)
type requestContextKey string
const (
serviceIdKey requestContextKey = "serviceId"
)
func withServiceId(ctx context.Context, serviceId string) context.Context {
return context.WithValue(ctx, serviceIdKey, serviceId)
}
func ServiceIdFromContext(ctx context.Context) string {
v := ctx.Value(serviceIdKey)
serviceId, ok := v.(string)
if !ok {
return ""
}
return serviceId
}