mirror of
https://github.com/netbirdio/netbird.git
synced 2026-10-03 12:09:09 +02:00
* [management] Require a private proxy cluster for cluster and direct upstream targets Cluster targets and direct upstream targets make the proxy dial the upstream from its own host network instead of through the embedded NetBird client. Only clusters running in private mode are meant to do that, but the service API accepted these targets on any cluster. Service create and update now reject such targets unless the service's proxy cluster reports the private capability. An unreported capability is treated as unsupported. * [management] Require every proxy in the cluster to be private The private capability is aggregated as any-true, so a cluster where only one proxy runs in private mode passed the check. The mapping is delivered to every proxy in the cluster, so the non-private ones would serve cluster and direct upstream targets from their host network too. Validate these targets against a unanimous aggregation instead. The existing any-true lookup stays as is for the dashboard flags and the agent network gateway.
366 lines
15 KiB
Go
366 lines
15 KiB
Go
// Code generated by MockGen. DO NOT EDIT.
|
|
// Source: ./manager.go
|
|
//
|
|
// Generated by this command:
|
|
//
|
|
// mockgen -package proxy -destination=manager_mock.go -source=./manager.go -build_flags=-mod=mod
|
|
//
|
|
|
|
// Package proxy is a generated GoMock package.
|
|
package proxy
|
|
|
|
import (
|
|
context "context"
|
|
reflect "reflect"
|
|
time "time"
|
|
|
|
proto "github.com/netbirdio/netbird/shared/management/proto"
|
|
gomock "go.uber.org/mock/gomock"
|
|
)
|
|
|
|
// MockManager is a mock of Manager interface.
|
|
type MockManager struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockManagerMockRecorder
|
|
isgomock struct{}
|
|
}
|
|
|
|
// MockManagerMockRecorder is the mock recorder for MockManager.
|
|
type MockManagerMockRecorder struct {
|
|
mock *MockManager
|
|
}
|
|
|
|
// NewMockManager creates a new mock instance.
|
|
func NewMockManager(ctrl *gomock.Controller) *MockManager {
|
|
mock := &MockManager{ctrl: ctrl}
|
|
mock.recorder = &MockManagerMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockManager) EXPECT() *MockManagerMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// CleanupStale mocks base method.
|
|
func (m *MockManager) CleanupStale(ctx context.Context, inactivityDuration time.Duration) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "CleanupStale", ctx, inactivityDuration)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// CleanupStale indicates an expected call of CleanupStale.
|
|
func (mr *MockManagerMockRecorder) CleanupStale(ctx, inactivityDuration any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CleanupStale", reflect.TypeOf((*MockManager)(nil).CleanupStale), ctx, inactivityDuration)
|
|
}
|
|
|
|
// ClusterAllProxiesPrivate mocks base method.
|
|
func (m *MockManager) ClusterAllProxiesPrivate(ctx context.Context, clusterAddr string) *bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "ClusterAllProxiesPrivate", ctx, clusterAddr)
|
|
ret0, _ := ret[0].(*bool)
|
|
return ret0
|
|
}
|
|
|
|
// ClusterAllProxiesPrivate indicates an expected call of ClusterAllProxiesPrivate.
|
|
func (mr *MockManagerMockRecorder) ClusterAllProxiesPrivate(ctx, clusterAddr any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClusterAllProxiesPrivate", reflect.TypeOf((*MockManager)(nil).ClusterAllProxiesPrivate), ctx, clusterAddr)
|
|
}
|
|
|
|
// ClusterRequireSubdomain mocks base method.
|
|
func (m *MockManager) ClusterRequireSubdomain(ctx context.Context, clusterAddr string) *bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "ClusterRequireSubdomain", ctx, clusterAddr)
|
|
ret0, _ := ret[0].(*bool)
|
|
return ret0
|
|
}
|
|
|
|
// ClusterRequireSubdomain indicates an expected call of ClusterRequireSubdomain.
|
|
func (mr *MockManagerMockRecorder) ClusterRequireSubdomain(ctx, clusterAddr any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClusterRequireSubdomain", reflect.TypeOf((*MockManager)(nil).ClusterRequireSubdomain), ctx, clusterAddr)
|
|
}
|
|
|
|
// ClusterSupportsCrowdSec mocks base method.
|
|
func (m *MockManager) ClusterSupportsCrowdSec(ctx context.Context, clusterAddr string) *bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "ClusterSupportsCrowdSec", ctx, clusterAddr)
|
|
ret0, _ := ret[0].(*bool)
|
|
return ret0
|
|
}
|
|
|
|
// ClusterSupportsCrowdSec indicates an expected call of ClusterSupportsCrowdSec.
|
|
func (mr *MockManagerMockRecorder) ClusterSupportsCrowdSec(ctx, clusterAddr any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClusterSupportsCrowdSec", reflect.TypeOf((*MockManager)(nil).ClusterSupportsCrowdSec), ctx, clusterAddr)
|
|
}
|
|
|
|
// ClusterSupportsCustomPorts mocks base method.
|
|
func (m *MockManager) ClusterSupportsCustomPorts(ctx context.Context, clusterAddr string) *bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "ClusterSupportsCustomPorts", ctx, clusterAddr)
|
|
ret0, _ := ret[0].(*bool)
|
|
return ret0
|
|
}
|
|
|
|
// ClusterSupportsCustomPorts indicates an expected call of ClusterSupportsCustomPorts.
|
|
func (mr *MockManagerMockRecorder) ClusterSupportsCustomPorts(ctx, clusterAddr any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClusterSupportsCustomPorts", reflect.TypeOf((*MockManager)(nil).ClusterSupportsCustomPorts), ctx, clusterAddr)
|
|
}
|
|
|
|
// ClusterSupportsPrivate mocks base method.
|
|
func (m *MockManager) ClusterSupportsPrivate(ctx context.Context, clusterAddr string) *bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "ClusterSupportsPrivate", ctx, clusterAddr)
|
|
ret0, _ := ret[0].(*bool)
|
|
return ret0
|
|
}
|
|
|
|
// ClusterSupportsPrivate indicates an expected call of ClusterSupportsPrivate.
|
|
func (mr *MockManagerMockRecorder) ClusterSupportsPrivate(ctx, clusterAddr any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClusterSupportsPrivate", reflect.TypeOf((*MockManager)(nil).ClusterSupportsPrivate), ctx, clusterAddr)
|
|
}
|
|
|
|
// ClusterSupportsSessionCode mocks base method.
|
|
func (m *MockManager) ClusterSupportsSessionCode(ctx context.Context, clusterAddr string) bool {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "ClusterSupportsSessionCode", ctx, clusterAddr)
|
|
ret0, _ := ret[0].(bool)
|
|
return ret0
|
|
}
|
|
|
|
// ClusterSupportsSessionCode indicates an expected call of ClusterSupportsSessionCode.
|
|
func (mr *MockManagerMockRecorder) ClusterSupportsSessionCode(ctx, clusterAddr any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ClusterSupportsSessionCode", reflect.TypeOf((*MockManager)(nil).ClusterSupportsSessionCode), ctx, clusterAddr)
|
|
}
|
|
|
|
// Connect mocks base method.
|
|
func (m *MockManager) Connect(ctx context.Context, proxyID, sessionID, clusterAddress, ipAddress, version string, accountID *string, capabilities *Capabilities) (*Proxy, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Connect", ctx, proxyID, sessionID, clusterAddress, ipAddress, version, accountID, capabilities)
|
|
ret0, _ := ret[0].(*Proxy)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// Connect indicates an expected call of Connect.
|
|
func (mr *MockManagerMockRecorder) Connect(ctx, proxyID, sessionID, clusterAddress, ipAddress, version, accountID, capabilities any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Connect", reflect.TypeOf((*MockManager)(nil).Connect), ctx, proxyID, sessionID, clusterAddress, ipAddress, version, accountID, capabilities)
|
|
}
|
|
|
|
// CountAccountProxies mocks base method.
|
|
func (m *MockManager) CountAccountProxies(ctx context.Context, accountID string) (int64, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "CountAccountProxies", ctx, accountID)
|
|
ret0, _ := ret[0].(int64)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// CountAccountProxies indicates an expected call of CountAccountProxies.
|
|
func (mr *MockManagerMockRecorder) CountAccountProxies(ctx, accountID any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CountAccountProxies", reflect.TypeOf((*MockManager)(nil).CountAccountProxies), ctx, accountID)
|
|
}
|
|
|
|
// DeleteAccountCluster mocks base method.
|
|
func (m *MockManager) DeleteAccountCluster(ctx context.Context, clusterAddress, accountID string) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "DeleteAccountCluster", ctx, clusterAddress, accountID)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// DeleteAccountCluster indicates an expected call of DeleteAccountCluster.
|
|
func (mr *MockManagerMockRecorder) DeleteAccountCluster(ctx, clusterAddress, accountID any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteAccountCluster", reflect.TypeOf((*MockManager)(nil).DeleteAccountCluster), ctx, clusterAddress, accountID)
|
|
}
|
|
|
|
// Disconnect mocks base method.
|
|
func (m *MockManager) Disconnect(ctx context.Context, proxyID, sessionID string) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Disconnect", ctx, proxyID, sessionID)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Disconnect indicates an expected call of Disconnect.
|
|
func (mr *MockManagerMockRecorder) Disconnect(ctx, proxyID, sessionID any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Disconnect", reflect.TypeOf((*MockManager)(nil).Disconnect), ctx, proxyID, sessionID)
|
|
}
|
|
|
|
// GetAccountProxy mocks base method.
|
|
func (m *MockManager) GetAccountProxy(ctx context.Context, accountID string) (*Proxy, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "GetAccountProxy", ctx, accountID)
|
|
ret0, _ := ret[0].(*Proxy)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// GetAccountProxy indicates an expected call of GetAccountProxy.
|
|
func (mr *MockManagerMockRecorder) GetAccountProxy(ctx, accountID any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAccountProxy", reflect.TypeOf((*MockManager)(nil).GetAccountProxy), ctx, accountID)
|
|
}
|
|
|
|
// GetActiveClusterAddresses mocks base method.
|
|
func (m *MockManager) GetActiveClusterAddresses(ctx context.Context) ([]string, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "GetActiveClusterAddresses", ctx)
|
|
ret0, _ := ret[0].([]string)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// GetActiveClusterAddresses indicates an expected call of GetActiveClusterAddresses.
|
|
func (mr *MockManagerMockRecorder) GetActiveClusterAddresses(ctx any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetActiveClusterAddresses", reflect.TypeOf((*MockManager)(nil).GetActiveClusterAddresses), ctx)
|
|
}
|
|
|
|
// GetActiveClusterAddressesForAccount mocks base method.
|
|
func (m *MockManager) GetActiveClusterAddressesForAccount(ctx context.Context, accountID string) ([]string, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "GetActiveClusterAddressesForAccount", ctx, accountID)
|
|
ret0, _ := ret[0].([]string)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// GetActiveClusterAddressesForAccount indicates an expected call of GetActiveClusterAddressesForAccount.
|
|
func (mr *MockManagerMockRecorder) GetActiveClusterAddressesForAccount(ctx, accountID any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetActiveClusterAddressesForAccount", reflect.TypeOf((*MockManager)(nil).GetActiveClusterAddressesForAccount), ctx, accountID)
|
|
}
|
|
|
|
// Heartbeat mocks base method.
|
|
func (m *MockManager) Heartbeat(ctx context.Context, p *Proxy) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "Heartbeat", ctx, p)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// Heartbeat indicates an expected call of Heartbeat.
|
|
func (mr *MockManagerMockRecorder) Heartbeat(ctx, p any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Heartbeat", reflect.TypeOf((*MockManager)(nil).Heartbeat), ctx, p)
|
|
}
|
|
|
|
// IsClusterAddressAvailable mocks base method.
|
|
func (m *MockManager) IsClusterAddressAvailable(ctx context.Context, clusterAddress, accountID string) (bool, error) {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "IsClusterAddressAvailable", ctx, clusterAddress, accountID)
|
|
ret0, _ := ret[0].(bool)
|
|
ret1, _ := ret[1].(error)
|
|
return ret0, ret1
|
|
}
|
|
|
|
// IsClusterAddressAvailable indicates an expected call of IsClusterAddressAvailable.
|
|
func (mr *MockManagerMockRecorder) IsClusterAddressAvailable(ctx, clusterAddress, accountID any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsClusterAddressAvailable", reflect.TypeOf((*MockManager)(nil).IsClusterAddressAvailable), ctx, clusterAddress, accountID)
|
|
}
|
|
|
|
// MockController is a mock of Controller interface.
|
|
type MockController struct {
|
|
ctrl *gomock.Controller
|
|
recorder *MockControllerMockRecorder
|
|
isgomock struct{}
|
|
}
|
|
|
|
// MockControllerMockRecorder is the mock recorder for MockController.
|
|
type MockControllerMockRecorder struct {
|
|
mock *MockController
|
|
}
|
|
|
|
// NewMockController creates a new mock instance.
|
|
func NewMockController(ctrl *gomock.Controller) *MockController {
|
|
mock := &MockController{ctrl: ctrl}
|
|
mock.recorder = &MockControllerMockRecorder{mock}
|
|
return mock
|
|
}
|
|
|
|
// EXPECT returns an object that allows the caller to indicate expected use.
|
|
func (m *MockController) EXPECT() *MockControllerMockRecorder {
|
|
return m.recorder
|
|
}
|
|
|
|
// GetOIDCValidationConfig mocks base method.
|
|
func (m *MockController) GetOIDCValidationConfig() OIDCValidationConfig {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "GetOIDCValidationConfig")
|
|
ret0, _ := ret[0].(OIDCValidationConfig)
|
|
return ret0
|
|
}
|
|
|
|
// GetOIDCValidationConfig indicates an expected call of GetOIDCValidationConfig.
|
|
func (mr *MockControllerMockRecorder) GetOIDCValidationConfig() *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOIDCValidationConfig", reflect.TypeOf((*MockController)(nil).GetOIDCValidationConfig))
|
|
}
|
|
|
|
// GetProxiesForCluster mocks base method.
|
|
func (m *MockController) GetProxiesForCluster(clusterAddr string) []string {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "GetProxiesForCluster", clusterAddr)
|
|
ret0, _ := ret[0].([]string)
|
|
return ret0
|
|
}
|
|
|
|
// GetProxiesForCluster indicates an expected call of GetProxiesForCluster.
|
|
func (mr *MockControllerMockRecorder) GetProxiesForCluster(clusterAddr any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetProxiesForCluster", reflect.TypeOf((*MockController)(nil).GetProxiesForCluster), clusterAddr)
|
|
}
|
|
|
|
// RegisterProxyToCluster mocks base method.
|
|
func (m *MockController) RegisterProxyToCluster(ctx context.Context, clusterAddr, proxyID string) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "RegisterProxyToCluster", ctx, clusterAddr, proxyID)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// RegisterProxyToCluster indicates an expected call of RegisterProxyToCluster.
|
|
func (mr *MockControllerMockRecorder) RegisterProxyToCluster(ctx, clusterAddr, proxyID any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RegisterProxyToCluster", reflect.TypeOf((*MockController)(nil).RegisterProxyToCluster), ctx, clusterAddr, proxyID)
|
|
}
|
|
|
|
// SendServiceUpdateToCluster mocks base method.
|
|
func (m *MockController) SendServiceUpdateToCluster(ctx context.Context, accountID string, update *proto.ProxyMapping, clusterAddr string) {
|
|
m.ctrl.T.Helper()
|
|
m.ctrl.Call(m, "SendServiceUpdateToCluster", ctx, accountID, update, clusterAddr)
|
|
}
|
|
|
|
// SendServiceUpdateToCluster indicates an expected call of SendServiceUpdateToCluster.
|
|
func (mr *MockControllerMockRecorder) SendServiceUpdateToCluster(ctx, accountID, update, clusterAddr any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendServiceUpdateToCluster", reflect.TypeOf((*MockController)(nil).SendServiceUpdateToCluster), ctx, accountID, update, clusterAddr)
|
|
}
|
|
|
|
// UnregisterProxyFromCluster mocks base method.
|
|
func (m *MockController) UnregisterProxyFromCluster(ctx context.Context, clusterAddr, proxyID string) error {
|
|
m.ctrl.T.Helper()
|
|
ret := m.ctrl.Call(m, "UnregisterProxyFromCluster", ctx, clusterAddr, proxyID)
|
|
ret0, _ := ret[0].(error)
|
|
return ret0
|
|
}
|
|
|
|
// UnregisterProxyFromCluster indicates an expected call of UnregisterProxyFromCluster.
|
|
func (mr *MockControllerMockRecorder) UnregisterProxyFromCluster(ctx, clusterAddr, proxyID any) *gomock.Call {
|
|
mr.mock.ctrl.T.Helper()
|
|
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "UnregisterProxyFromCluster", reflect.TypeOf((*MockController)(nil).UnregisterProxyFromCluster), ctx, clusterAddr, proxyID)
|
|
}
|