manager

package
v0.71.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// EnvAutoAssignPortMin overrides the lower bound for auto-assigned L4 listen ports.
	EnvAutoAssignPortMin = "NB_PROXY_PORT_MIN"
	// EnvAutoAssignPortMax overrides the upper bound for auto-assigned L4 listen ports.
	EnvAutoAssignPortMax = "NB_PROXY_PORT_MAX"
)

Variables

This section is empty.

Functions

func RegisterEndpoints

func RegisterEndpoints(manager rpservice.Manager, domainManager domainmanager.Manager, accessLogsManager accesslogs.Manager, permissionsManager permissions.Manager, router *mux.Router)

RegisterEndpoints registers all service HTTP endpoints.

Types

type CapabilityProvider added in v0.67.2

type CapabilityProvider interface {
	ClusterSupportsCustomPorts(ctx context.Context, clusterAddr string) *bool
	ClusterRequireSubdomain(ctx context.Context, clusterAddr string) *bool
	ClusterSupportsCrowdSec(ctx context.Context, clusterAddr string) *bool
}

CapabilityProvider queries proxy cluster capabilities from the database.

type ClusterDeriver

type ClusterDeriver interface {
	DeriveClusterFromDomain(ctx context.Context, accountID, domain string) (string, error)
	GetClusterDomains() []string
}

ClusterDeriver derives the proxy cluster from a domain.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(store store.Store, accountManager account.Manager, permissionsManager permissions.Manager, proxyController proxy.Controller, capabilities CapabilityProvider, clusterDeriver ClusterDeriver) *Manager

NewManager creates a new service manager.

func (*Manager) CreateService

func (m *Manager) CreateService(ctx context.Context, accountID, userID string, s *service.Service) (*service.Service, error)

func (*Manager) CreateServiceFromPeer

func (m *Manager) CreateServiceFromPeer(ctx context.Context, accountID, peerID string, req *service.ExposeServiceRequest) (*service.ExposeServiceResponse, error)

CreateServiceFromPeer creates a service initiated by a peer expose request. It validates the request, checks expose permissions, enforces the per-peer limit, creates the service, and tracks it for TTL-based reaping.

func (*Manager) DeleteAccountCluster added in v0.71.0

func (m *Manager) DeleteAccountCluster(ctx context.Context, accountID, userID, clusterAddress string) error

DeleteAccountCluster removes all proxy registrations for the given cluster address owned by the account.

func (*Manager) DeleteAllServices

func (m *Manager) DeleteAllServices(ctx context.Context, accountID, userID string) error

func (*Manager) DeleteService

func (m *Manager) DeleteService(ctx context.Context, accountID, userID, serviceID string) error

func (*Manager) GetAccountServices

func (m *Manager) GetAccountServices(ctx context.Context, accountID string) ([]*service.Service, error)

func (*Manager) GetAllServices

func (m *Manager) GetAllServices(ctx context.Context, accountID, userID string) ([]*service.Service, error)

func (*Manager) GetClusters added in v0.71.3

func (m *Manager) GetClusters(ctx context.Context, accountID, userID string) ([]proxy.Cluster, error)

GetClusters returns every proxy cluster visible to the account (shared + its own BYOP), regardless of whether any proxy in the cluster is currently heartbeating. Each cluster is enriched with the capability flags reported by its active proxies so the dashboard can render feature support without a second round-trip.

func (*Manager) GetGlobalServices

func (m *Manager) GetGlobalServices(ctx context.Context) ([]*service.Service, error)

func (*Manager) GetService

func (m *Manager) GetService(ctx context.Context, accountID, userID, serviceID string) (*service.Service, error)

func (*Manager) GetServiceByDomain added in v0.71.0

func (m *Manager) GetServiceByDomain(ctx context.Context, domain string) (*service.Service, error)

func (*Manager) GetServiceByID

func (m *Manager) GetServiceByID(ctx context.Context, accountID, serviceID string) (*service.Service, error)

func (*Manager) GetServiceIDByTargetID

func (m *Manager) GetServiceIDByTargetID(ctx context.Context, accountID string, resourceID string) (string, error)

func (*Manager) ReloadAllServicesForAccount

func (m *Manager) ReloadAllServicesForAccount(ctx context.Context, accountID string) error

func (*Manager) ReloadService

func (m *Manager) ReloadService(ctx context.Context, accountID, serviceID string) error

func (*Manager) RenewServiceFromPeer

func (m *Manager) RenewServiceFromPeer(ctx context.Context, accountID, peerID, serviceID string) error

RenewServiceFromPeer updates the DB timestamp for the peer's ephemeral service.

func (*Manager) SetCertificateIssuedAt

func (m *Manager) SetCertificateIssuedAt(ctx context.Context, accountID, serviceID string) error

SetCertificateIssuedAt sets the certificate issued timestamp to the current time. Call this when receiving a gRPC notification that the certificate was issued.

func (*Manager) SetStatus

func (m *Manager) SetStatus(ctx context.Context, accountID, serviceID string, status service.Status) error

SetStatus updates the status of the service (e.g., "active", "tunnel_not_created", etc.)

func (*Manager) StartExposeReaper

func (m *Manager) StartExposeReaper(ctx context.Context)

StartExposeReaper starts the background goroutine that reaps expired ephemeral services.

func (*Manager) StopServiceFromPeer

func (m *Manager) StopServiceFromPeer(ctx context.Context, accountID, peerID, serviceID string) error

StopServiceFromPeer stops a peer's active expose session by deleting the service from the DB.

func (*Manager) UpdateService

func (m *Manager) UpdateService(ctx context.Context, accountID, userID string, service *service.Service) (*service.Service, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL