Documentation
¶
Overview ¶
Package controller is a generated GoMock package.
Index ¶
- func ComputeForwarderPortFromData(peers map[string]*nmdata.Peer, requiredVersion string) int64
- func IPv6AllowedPeersFromData(nmData *networkmap.NetworkMapData) map[string]struct{}
- func NetworkMapFromData(ctx context.Context, nmData *networkmap.NetworkMapData, peerID string, ...) *types.NetworkMap
- type Controller
- func (c *Controller) BufferUpdateAccountPeers(ctx context.Context, accountID string, reason types.UpdateReason) error
- func (c *Controller) BufferUpdateAffectedPeers(ctx context.Context, accountID string, peerIDs []string, ...) error
- func (c *Controller) CountStreams() int
- func (c *Controller) DisconnectPeers(ctx context.Context, accountId string, peerIDs []string)
- func (c *Controller) GetDNSDomain(settings *types.Settings) string
- func (c *Controller) GetNetworkMap(ctx context.Context, peerID string) (*types.NetworkMap, error)
- func (c *Controller) GetValidatedPeerWithComponents(ctx context.Context, isRequiresApproval bool, accountID string, ...) (*nbpeer.Peer, *types.NetworkMapComponents, *types.NetworkMap, ...)
- func (c *Controller) GetValidatedPeerWithMap(ctx context.Context, isRequiresApproval bool, accountID string, peerID string) (*types.NetworkMap, []*nmdata.PostureChecks, int64, error)
- func (c *Controller) OnPeerConnected(ctx context.Context, accountID string, peerID string) (chan *network_map.UpdateMessage, error)
- func (c *Controller) OnPeerDisconnected(ctx context.Context, accountID string, peerID string)
- func (c *Controller) OnPeersAdded(ctx context.Context, accountID string, peerIDs []string, ...) error
- func (c *Controller) OnPeersDeleted(ctx context.Context, accountID string, peerIDs []string, ...) error
- func (c *Controller) OnPeersUpdated(ctx context.Context, accountID string, peerIDs []string, ...) error
- func (c *Controller) StartWarmup(ctx context.Context)
- func (c *Controller) TrackEphemeralPeer(ctx context.Context, peer *nbpeer.Peer)
- func (c *Controller) UpdateAccountPeer(ctx context.Context, accountId string, peerId string) error
- func (c *Controller) UpdateAccountPeers(ctx context.Context, accountID string, reason types.UpdateReason) error
- func (c *Controller) UpdateAffectedPeers(ctx context.Context, accountID string, peerIDs []string) error
- type MockRepository
- func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
- func (m *MockRepository) GetAccountByPeerID(ctx context.Context, peerID string) (*types.Account, error)
- func (m *MockRepository) GetAccountNetwork(ctx context.Context, accountID string) (*types.Network, error)
- func (m *MockRepository) GetAccountPeers(ctx context.Context, accountID string) ([]*peer.Peer, error)
- func (m *MockRepository) GetAccountZones(ctx context.Context, accountID string) ([]*zones.Zone, error)
- func (m *MockRepository) GetPeerByID(ctx context.Context, accountID, peerID string) (*peer.Peer, error)
- func (m *MockRepository) GetPeersByIDs(ctx context.Context, accountID string, peerIDs []string) (map[string]*peer.Peer, error)
- func (m *MockRepository) SynthesizeAgentNetworkServices(ctx context.Context, accountID string) ([]*service.Service, error)
- type MockRepositoryMockRecorder
- func (mr *MockRepositoryMockRecorder) GetAccountByPeerID(ctx, peerID any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) GetAccountNetwork(ctx, accountID any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) GetAccountPeers(ctx, accountID any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) GetAccountZones(ctx, accountID any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) GetPeerByID(ctx, accountID, peerID any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) GetPeersByIDs(ctx, accountID, peerIDs any) *gomock.Call
- func (mr *MockRepositoryMockRecorder) SynthesizeAgentNetworkServices(ctx, accountID any) *gomock.Call
- type Repository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeForwarderPortFromData ¶ added in v0.78.0
func IPv6AllowedPeersFromData ¶ added in v0.78.0
func IPv6AllowedPeersFromData(nmData *networkmap.NetworkMapData) map[string]struct{}
func NetworkMapFromData ¶ added in v0.78.0
func NetworkMapFromData(ctx context.Context, nmData *networkmap.NetworkMapData, peerID string, peersCustomZone nmdata.CustomZone, metrics *telemetry.AccountManagerMetrics) *types.NetworkMap
Types ¶
type Controller ¶
type Controller struct {
EphemeralPeersManager ephemeral.Manager
// contains filtered or unexported fields
}
func NewController ¶
func NewController(ctx context.Context, store store.Store, metrics telemetry.AppMetrics, peersUpdateManager network_map.PeersUpdateManager, requestBuffer account.RequestBuffer, integratedPeerValidator integrated_validator.IntegratedValidator, settingsManager settings.Manager, dnsDomain string, proxyController port_forwarding.Controller, ephemeralPeersManager ephemeral.Manager, config *config.Config, nmdataStore *networkmapdb.NetworkMapDBStoreImpl) *Controller
func (*Controller) BufferUpdateAccountPeers ¶
func (c *Controller) BufferUpdateAccountPeers(ctx context.Context, accountID string, reason types.UpdateReason) error
func (*Controller) BufferUpdateAffectedPeers ¶ added in v0.73.0
func (c *Controller) BufferUpdateAffectedPeers(ctx context.Context, accountID string, peerIDs []string, reason types.UpdateReason) error
BufferUpdateAffectedPeers accumulates peer IDs and flushes them after the buffer interval.
func (*Controller) CountStreams ¶ added in v0.60.5
func (c *Controller) CountStreams() int
func (*Controller) DisconnectPeers ¶
func (c *Controller) DisconnectPeers(ctx context.Context, accountId string, peerIDs []string)
func (*Controller) GetDNSDomain ¶
func (c *Controller) GetDNSDomain(settings *types.Settings) string
GetDNSDomain returns the configured dnsDomain
func (*Controller) GetNetworkMap ¶
func (c *Controller) GetNetworkMap(ctx context.Context, peerID string) (*types.NetworkMap, error)
GetNetworkMap returns Network map for a given peer (omits original peer from the Peers result)
func (*Controller) GetValidatedPeerWithComponents ¶ added in v0.75.0
func (c *Controller) GetValidatedPeerWithComponents(ctx context.Context, isRequiresApproval bool, accountID string, peer *nbpeer.Peer) (*nbpeer.Peer, *types.NetworkMapComponents, *types.NetworkMap, []*nmdata.PostureChecks, int64, error)
GetValidatedPeerWithComponents is the components-format counterpart of GetValidatedPeerWithMap. It returns raw NetworkMapComponents for capable peers along with the proxy NetworkMap fragment (BYOP / port-forwarding data the legacy server folds in via NetworkMap.Merge). The gRPC layer encodes both into the wire envelope. Callers must gate on capability themselves before dispatching here — this method does NOT branch on it.
func (*Controller) GetValidatedPeerWithMap ¶
func (c *Controller) GetValidatedPeerWithMap(ctx context.Context, isRequiresApproval bool, accountID string, peerID string) (*types.NetworkMap, []*nmdata.PostureChecks, int64, error)
func (*Controller) OnPeerConnected ¶ added in v0.60.5
func (c *Controller) OnPeerConnected(ctx context.Context, accountID string, peerID string) (chan *network_map.UpdateMessage, error)
func (*Controller) OnPeerDisconnected ¶ added in v0.60.5
func (c *Controller) OnPeerDisconnected(ctx context.Context, accountID string, peerID string)
func (*Controller) OnPeersAdded ¶ added in v0.60.5
func (*Controller) OnPeersDeleted ¶ added in v0.60.5
func (*Controller) OnPeersUpdated ¶ added in v0.60.5
func (*Controller) StartWarmup ¶
func (c *Controller) StartWarmup(ctx context.Context)
func (*Controller) TrackEphemeralPeer ¶ added in v0.64.1
func (c *Controller) TrackEphemeralPeer(ctx context.Context, peer *nbpeer.Peer)
func (*Controller) UpdateAccountPeer ¶
func (*Controller) UpdateAccountPeers ¶
func (c *Controller) UpdateAccountPeers(ctx context.Context, accountID string, reason types.UpdateReason) error
UpdatePeers updates all peers that belong to an account. Should be called when changes have to be synced to peers.
func (*Controller) UpdateAffectedPeers ¶ added in v0.73.0
func (c *Controller) UpdateAffectedPeers(ctx context.Context, accountID string, peerIDs []string) error
UpdateAffectedPeers updates only the specified peers that belong to an account.
type MockRepository ¶ added in v0.78.0
type MockRepository struct {
// contains filtered or unexported fields
}
MockRepository is a mock of Repository interface.
func NewMockRepository ¶ added in v0.78.0
func NewMockRepository(ctrl *gomock.Controller) *MockRepository
NewMockRepository creates a new mock instance.
func (*MockRepository) EXPECT ¶ added in v0.78.0
func (m *MockRepository) EXPECT() *MockRepositoryMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockRepository) GetAccountByPeerID ¶ added in v0.78.0
func (m *MockRepository) GetAccountByPeerID(ctx context.Context, peerID string) (*types.Account, error)
GetAccountByPeerID mocks base method.
func (*MockRepository) GetAccountNetwork ¶ added in v0.78.0
func (m *MockRepository) GetAccountNetwork(ctx context.Context, accountID string) (*types.Network, error)
GetAccountNetwork mocks base method.
func (*MockRepository) GetAccountPeers ¶ added in v0.78.0
func (m *MockRepository) GetAccountPeers(ctx context.Context, accountID string) ([]*peer.Peer, error)
GetAccountPeers mocks base method.
func (*MockRepository) GetAccountZones ¶ added in v0.78.0
func (m *MockRepository) GetAccountZones(ctx context.Context, accountID string) ([]*zones.Zone, error)
GetAccountZones mocks base method.
func (*MockRepository) GetPeerByID ¶ added in v0.78.0
func (m *MockRepository) GetPeerByID(ctx context.Context, accountID, peerID string) (*peer.Peer, error)
GetPeerByID mocks base method.
func (*MockRepository) GetPeersByIDs ¶ added in v0.78.0
func (m *MockRepository) GetPeersByIDs(ctx context.Context, accountID string, peerIDs []string) (map[string]*peer.Peer, error)
GetPeersByIDs mocks base method.
func (*MockRepository) SynthesizeAgentNetworkServices ¶ added in v0.78.0
func (m *MockRepository) SynthesizeAgentNetworkServices(ctx context.Context, accountID string) ([]*service.Service, error)
SynthesizeAgentNetworkServices mocks base method.
type MockRepositoryMockRecorder ¶ added in v0.78.0
type MockRepositoryMockRecorder struct {
// contains filtered or unexported fields
}
MockRepositoryMockRecorder is the mock recorder for MockRepository.
func (*MockRepositoryMockRecorder) GetAccountByPeerID ¶ added in v0.78.0
func (mr *MockRepositoryMockRecorder) GetAccountByPeerID(ctx, peerID any) *gomock.Call
GetAccountByPeerID indicates an expected call of GetAccountByPeerID.
func (*MockRepositoryMockRecorder) GetAccountNetwork ¶ added in v0.78.0
func (mr *MockRepositoryMockRecorder) GetAccountNetwork(ctx, accountID any) *gomock.Call
GetAccountNetwork indicates an expected call of GetAccountNetwork.
func (*MockRepositoryMockRecorder) GetAccountPeers ¶ added in v0.78.0
func (mr *MockRepositoryMockRecorder) GetAccountPeers(ctx, accountID any) *gomock.Call
GetAccountPeers indicates an expected call of GetAccountPeers.
func (*MockRepositoryMockRecorder) GetAccountZones ¶ added in v0.78.0
func (mr *MockRepositoryMockRecorder) GetAccountZones(ctx, accountID any) *gomock.Call
GetAccountZones indicates an expected call of GetAccountZones.
func (*MockRepositoryMockRecorder) GetPeerByID ¶ added in v0.78.0
func (mr *MockRepositoryMockRecorder) GetPeerByID(ctx, accountID, peerID any) *gomock.Call
GetPeerByID indicates an expected call of GetPeerByID.
func (*MockRepositoryMockRecorder) GetPeersByIDs ¶ added in v0.78.0
func (mr *MockRepositoryMockRecorder) GetPeersByIDs(ctx, accountID, peerIDs any) *gomock.Call
GetPeersByIDs indicates an expected call of GetPeersByIDs.
func (*MockRepositoryMockRecorder) SynthesizeAgentNetworkServices ¶ added in v0.78.0
func (mr *MockRepositoryMockRecorder) SynthesizeAgentNetworkServices(ctx, accountID any) *gomock.Call
SynthesizeAgentNetworkServices indicates an expected call of SynthesizeAgentNetworkServices.
type Repository ¶
type Repository interface {
GetAccountNetwork(ctx context.Context, accountID string) (*types.Network, error)
GetAccountPeers(ctx context.Context, accountID string) ([]*peer.Peer, error)
GetAccountByPeerID(ctx context.Context, peerID string) (*types.Account, error)
GetPeersByIDs(ctx context.Context, accountID string, peerIDs []string) (map[string]*peer.Peer, error)
GetPeerByID(ctx context.Context, accountID string, peerID string) (*peer.Peer, error)
GetAccountZones(ctx context.Context, accountID string) ([]*zones.Zone, error)
// SynthesizeAgentNetworkServices returns the in-memory reverse-proxy
// services synthesised from the account's agent-network provider/policy
// state. Empty for accounts without agent-network providers.
SynthesizeAgentNetworkServices(ctx context.Context, accountID string) ([]*service.Service, error)
GetAccountServices(ctx context.Context, accountID string) ([]*service.Service, error)
}