proxy

package
v0.74.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: BSD-3-Clause, AGPL-3.0 Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package proxy is a generated GoMock package.

Index

Constants

View Source
const (
	StatusConnected    = "connected"
	StatusDisconnected = "disconnected"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Capabilities added in v0.67.2

type Capabilities struct {
	// SupportsCustomPorts indicates whether this proxy can bind arbitrary
	// ports for TCP/UDP services. TLS uses SNI routing and is not gated.
	SupportsCustomPorts *bool
	// RequireSubdomain indicates whether a subdomain label is required in
	// front of the cluster domain.
	RequireSubdomain *bool
	// SupportsCrowdsec indicates whether this proxy has CrowdSec configured.
	SupportsCrowdsec *bool
	// Private indicates whether this proxy supports inbound access via Wireguard
	// tunnel and netbird-only authentication policies
	Private *bool
}

Capabilities describes what a proxy can handle, as reported via gRPC. Nil fields mean the proxy never reported this capability.

type Cluster added in v0.67.0

type Cluster struct {
	ID               string
	Address          string
	Type             ClusterType
	Online           bool
	ConnectedProxies int
	// *bool: nil = no proxy reported the capability; the dashboard renders that as unknown.
	SupportsCustomPorts *bool
	RequireSubdomain    *bool
	SupportsCrowdSec    *bool
	Private             *bool
}

Cluster represents a group of proxy nodes serving the same address.

Online and ConnectedProxies derive from the same 2-min active window the rest of the module uses, but Cluster rows are not gated on it — the cluster listing surfaces offline clusters too so operators can see and clean them up. The 1-hour heartbeat reaper still bounds the table eventually.

type ClusterType added in v0.71.3

type ClusterType string

ClusterType is the source of a proxy cluster.

const (
	// ClusterTypeAccount is a cluster operated by the account itself (BYOP) —
	// at least one proxy row in the cluster carries a non-NULL account_id.
	ClusterTypeAccount ClusterType = "account"
	// ClusterTypeShared is a cluster operated by NetBird and shared across
	// accounts — all proxy rows in the cluster have account_id IS NULL.
	ClusterTypeShared ClusterType = "shared"
)

type Controller

type Controller interface {
	SendServiceUpdateToCluster(ctx context.Context, accountID string, update *proto.ProxyMapping, clusterAddr string)
	GetOIDCValidationConfig() OIDCValidationConfig
	RegisterProxyToCluster(ctx context.Context, clusterAddr, proxyID string) error
	UnregisterProxyFromCluster(ctx context.Context, clusterAddr, proxyID string) error
	GetProxiesForCluster(clusterAddr string) []string
}

Controller is responsible for managing proxy clusters and routing service updates.

type Manager

type Manager interface {
	Connect(ctx context.Context, proxyID, sessionID, clusterAddress, ipAddress string, accountID *string, capabilities *Capabilities) (*Proxy, error)
	Disconnect(ctx context.Context, proxyID, sessionID string) error
	Heartbeat(ctx context.Context, p *Proxy) error
	GetActiveClusterAddresses(ctx context.Context) ([]string, error)
	GetActiveClusterAddressesForAccount(ctx context.Context, accountID string) ([]string, error)
	ClusterSupportsCustomPorts(ctx context.Context, clusterAddr string) *bool
	ClusterRequireSubdomain(ctx context.Context, clusterAddr string) *bool
	ClusterSupportsCrowdSec(ctx context.Context, clusterAddr string) *bool
	ClusterSupportsPrivate(ctx context.Context, clusterAddr string) *bool
	CleanupStale(ctx context.Context, inactivityDuration time.Duration) error
	GetAccountProxy(ctx context.Context, accountID string) (*Proxy, error)
	CountAccountProxies(ctx context.Context, accountID string) (int64, error)
	IsClusterAddressAvailable(ctx context.Context, clusterAddress, accountID string) (bool, error)
	DeleteAccountCluster(ctx context.Context, clusterAddress, accountID string) error
}

Manager defines the interface for proxy operations

type MockController

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

MockController is a mock of Controller interface.

func NewMockController

func NewMockController(ctrl *gomock.Controller) *MockController

NewMockController creates a new mock instance.

func (*MockController) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockController) GetOIDCValidationConfig

func (m *MockController) GetOIDCValidationConfig() OIDCValidationConfig

GetOIDCValidationConfig mocks base method.

func (*MockController) GetProxiesForCluster

func (m *MockController) GetProxiesForCluster(clusterAddr string) []string

GetProxiesForCluster mocks base method.

func (*MockController) RegisterProxyToCluster

func (m *MockController) RegisterProxyToCluster(ctx context.Context, clusterAddr, proxyID string) error

RegisterProxyToCluster mocks base method.

func (*MockController) SendServiceUpdateToCluster

func (m *MockController) SendServiceUpdateToCluster(ctx context.Context, accountID string, update *proto.ProxyMapping, clusterAddr string)

SendServiceUpdateToCluster mocks base method.

func (*MockController) UnregisterProxyFromCluster

func (m *MockController) UnregisterProxyFromCluster(ctx context.Context, clusterAddr, proxyID string) error

UnregisterProxyFromCluster mocks base method.

type MockControllerMockRecorder

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

MockControllerMockRecorder is the mock recorder for MockController.

func (*MockControllerMockRecorder) GetOIDCValidationConfig

func (mr *MockControllerMockRecorder) GetOIDCValidationConfig() *gomock.Call

GetOIDCValidationConfig indicates an expected call of GetOIDCValidationConfig.

func (*MockControllerMockRecorder) GetProxiesForCluster

func (mr *MockControllerMockRecorder) GetProxiesForCluster(clusterAddr interface{}) *gomock.Call

GetProxiesForCluster indicates an expected call of GetProxiesForCluster.

func (*MockControllerMockRecorder) RegisterProxyToCluster

func (mr *MockControllerMockRecorder) RegisterProxyToCluster(ctx, clusterAddr, proxyID interface{}) *gomock.Call

RegisterProxyToCluster indicates an expected call of RegisterProxyToCluster.

func (*MockControllerMockRecorder) SendServiceUpdateToCluster

func (mr *MockControllerMockRecorder) SendServiceUpdateToCluster(ctx, accountID, update, clusterAddr interface{}) *gomock.Call

SendServiceUpdateToCluster indicates an expected call of SendServiceUpdateToCluster.

func (*MockControllerMockRecorder) UnregisterProxyFromCluster

func (mr *MockControllerMockRecorder) UnregisterProxyFromCluster(ctx, clusterAddr, proxyID interface{}) *gomock.Call

UnregisterProxyFromCluster indicates an expected call of UnregisterProxyFromCluster.

type MockManager

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

MockManager is a mock of Manager interface.

func NewMockManager

func NewMockManager(ctrl *gomock.Controller) *MockManager

NewMockManager creates a new mock instance.

func (*MockManager) CleanupStale

func (m *MockManager) CleanupStale(ctx context.Context, inactivityDuration time.Duration) error

CleanupStale mocks base method.

func (*MockManager) ClusterRequireSubdomain added in v0.67.2

func (m *MockManager) ClusterRequireSubdomain(ctx context.Context, clusterAddr string) *bool

ClusterRequireSubdomain mocks base method.

func (*MockManager) ClusterSupportsCrowdSec added in v0.69.0

func (m *MockManager) ClusterSupportsCrowdSec(ctx context.Context, clusterAddr string) *bool

ClusterSupportsCrowdSec mocks base method.

func (*MockManager) ClusterSupportsCustomPorts added in v0.67.2

func (m *MockManager) ClusterSupportsCustomPorts(ctx context.Context, clusterAddr string) *bool

ClusterSupportsCustomPorts mocks base method.

func (*MockManager) ClusterSupportsPrivate added in v0.72.0

func (m *MockManager) ClusterSupportsPrivate(ctx context.Context, clusterAddr string) *bool

ClusterSupportsPrivate mocks base method.

func (*MockManager) Connect

func (m *MockManager) Connect(ctx context.Context, proxyID, sessionID, clusterAddress, ipAddress string, accountID *string, capabilities *Capabilities) (*Proxy, error)

Connect mocks base method.

func (*MockManager) CountAccountProxies added in v0.71.0

func (m *MockManager) CountAccountProxies(ctx context.Context, accountID string) (int64, error)

CountAccountProxies mocks base method.

func (*MockManager) DeleteAccountCluster added in v0.71.0

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

DeleteAccountCluster mocks base method.

func (*MockManager) Disconnect

func (m *MockManager) Disconnect(ctx context.Context, proxyID, sessionID string) error

Disconnect mocks base method.

func (*MockManager) EXPECT

func (m *MockManager) EXPECT() *MockManagerMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockManager) GetAccountProxy added in v0.71.0

func (m *MockManager) GetAccountProxy(ctx context.Context, accountID string) (*Proxy, error)

GetAccountProxy mocks base method.

func (*MockManager) GetActiveClusterAddresses

func (m *MockManager) GetActiveClusterAddresses(ctx context.Context) ([]string, error)

GetActiveClusterAddresses mocks base method.

func (*MockManager) GetActiveClusterAddressesForAccount added in v0.71.0

func (m *MockManager) GetActiveClusterAddressesForAccount(ctx context.Context, accountID string) ([]string, error)

func (*MockManager) Heartbeat

func (m *MockManager) Heartbeat(ctx context.Context, p *Proxy) error

Heartbeat mocks base method.

func (*MockManager) IsClusterAddressAvailable added in v0.71.0

func (m *MockManager) IsClusterAddressAvailable(ctx context.Context, clusterAddress, accountID string) (bool, error)

IsClusterAddressAvailable mocks base method.

type MockManagerMockRecorder

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

MockManagerMockRecorder is the mock recorder for MockManager.

func (*MockManagerMockRecorder) CleanupStale

func (mr *MockManagerMockRecorder) CleanupStale(ctx, inactivityDuration interface{}) *gomock.Call

CleanupStale indicates an expected call of CleanupStale.

func (*MockManagerMockRecorder) ClusterRequireSubdomain added in v0.67.2

func (mr *MockManagerMockRecorder) ClusterRequireSubdomain(ctx, clusterAddr interface{}) *gomock.Call

ClusterRequireSubdomain indicates an expected call of ClusterRequireSubdomain.

func (*MockManagerMockRecorder) ClusterSupportsCrowdSec added in v0.69.0

func (mr *MockManagerMockRecorder) ClusterSupportsCrowdSec(ctx, clusterAddr interface{}) *gomock.Call

ClusterSupportsCrowdSec indicates an expected call of ClusterSupportsCrowdSec.

func (*MockManagerMockRecorder) ClusterSupportsCustomPorts added in v0.67.2

func (mr *MockManagerMockRecorder) ClusterSupportsCustomPorts(ctx, clusterAddr interface{}) *gomock.Call

ClusterSupportsCustomPorts indicates an expected call of ClusterSupportsCustomPorts.

func (*MockManagerMockRecorder) ClusterSupportsPrivate added in v0.72.0

func (mr *MockManagerMockRecorder) ClusterSupportsPrivate(ctx, clusterAddr interface{}) *gomock.Call

ClusterSupportsPrivate indicates an expected call of ClusterSupportsPrivate.

func (*MockManagerMockRecorder) Connect

func (mr *MockManagerMockRecorder) Connect(ctx, proxyID, sessionID, clusterAddress, ipAddress, accountID, capabilities interface{}) *gomock.Call

Connect indicates an expected call of Connect.

func (*MockManagerMockRecorder) CountAccountProxies added in v0.71.0

func (mr *MockManagerMockRecorder) CountAccountProxies(ctx, accountID interface{}) *gomock.Call

CountAccountProxies indicates an expected call of CountAccountProxies.

func (*MockManagerMockRecorder) DeleteAccountCluster added in v0.71.0

func (mr *MockManagerMockRecorder) DeleteAccountCluster(ctx, clusterAddress, accountID interface{}) *gomock.Call

DeleteAccountCluster indicates an expected call of DeleteAccountCluster.

func (*MockManagerMockRecorder) Disconnect

func (mr *MockManagerMockRecorder) Disconnect(ctx, proxyID, sessionID interface{}) *gomock.Call

Disconnect indicates an expected call of Disconnect.

func (*MockManagerMockRecorder) GetAccountProxy added in v0.71.0

func (mr *MockManagerMockRecorder) GetAccountProxy(ctx, accountID interface{}) *gomock.Call

GetAccountProxy indicates an expected call of GetAccountProxy.

func (*MockManagerMockRecorder) GetActiveClusterAddresses

func (mr *MockManagerMockRecorder) GetActiveClusterAddresses(ctx interface{}) *gomock.Call

GetActiveClusterAddresses indicates an expected call of GetActiveClusterAddresses.

func (*MockManagerMockRecorder) GetActiveClusterAddressesForAccount added in v0.71.0

func (mr *MockManagerMockRecorder) GetActiveClusterAddressesForAccount(ctx, accountID interface{}) *gomock.Call

func (*MockManagerMockRecorder) Heartbeat

func (mr *MockManagerMockRecorder) Heartbeat(ctx, p interface{}) *gomock.Call

Heartbeat indicates an expected call of Heartbeat.

func (*MockManagerMockRecorder) IsClusterAddressAvailable added in v0.71.0

func (mr *MockManagerMockRecorder) IsClusterAddressAvailable(ctx, clusterAddress, accountID interface{}) *gomock.Call

IsClusterAddressAvailable indicates an expected call of IsClusterAddressAvailable.

type OIDCValidationConfig

type OIDCValidationConfig struct {
	Issuer             string
	Audiences          []string
	KeysLocation       string
	MaxTokenAgeSeconds int64
}

OIDCValidationConfig contains the OIDC configuration needed for token validation.

type Proxy

type Proxy struct {
	ID             string    `gorm:"primaryKey;type:varchar(255)"`
	SessionID      string    `gorm:"type:varchar(36)"`
	ClusterAddress string    `gorm:"type:varchar(255);not null;index:idx_proxy_cluster_status"`
	IPAddress      string    `gorm:"type:varchar(45)"`
	AccountID      *string   `gorm:"type:varchar(255);index:idx_proxy_account_id"`
	LastSeen       time.Time `gorm:"not null;index:idx_proxy_last_seen"`
	ConnectedAt    *time.Time
	DisconnectedAt *time.Time
	Status         string       `gorm:"type:varchar(20);not null;index:idx_proxy_cluster_status"`
	Capabilities   Capabilities `gorm:"embedded"`
	CreatedAt      time.Time
	UpdatedAt      time.Time
}

Proxy represents a reverse proxy instance

func (Proxy) TableName

func (Proxy) TableName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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