mock_server

package
v0.0.0-...-93fed14 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ManagementServiceServerMock

type ManagementServiceServerMock struct {
	proto.UnimplementedManagementServiceServer

	LoginFunc                      func(context.Context, *proto.EncryptedMessage) (*proto.EncryptedMessage, error)
	SyncFunc                       func(*proto.EncryptedMessage, proto.ManagementService_SyncServer)
	GetServerKeyFunc               func(context.Context, *proto.Empty) (*proto.ServerKeyResponse, error)
	IsHealthyFunc                  func(context.Context, *proto.Empty) (*proto.Empty, error)
	GetDeviceAuthorizationFlowFunc func(ctx context.Context, req *proto.EncryptedMessage) (*proto.EncryptedMessage, error)
	GetPKCEAuthorizationFlowFunc   func(ctx context.Context, req *proto.EncryptedMessage) (*proto.EncryptedMessage, error)
}

func (ManagementServiceServerMock) GetDeviceAuthorizationFlow

func (m ManagementServiceServerMock) GetDeviceAuthorizationFlow(ctx context.Context, req *proto.EncryptedMessage) (*proto.EncryptedMessage, error)

func (ManagementServiceServerMock) GetPKCEAuthorizationFlow

func (ManagementServiceServerMock) GetServerKey

func (ManagementServiceServerMock) IsHealthy

func (m ManagementServiceServerMock) IsHealthy(ctx context.Context, empty *proto.Empty) (*proto.Empty, error)

func (ManagementServiceServerMock) Login

func (ManagementServiceServerMock) Sync

type MockAccountManager

type MockAccountManager struct {
	GetOrCreateAccountByUserFunc func(userId, domain string) (*server.Account, error)
	CreateSetupKeyFunc           func(accountId string, keyName string, keyType server.SetupKeyType,
		expiresIn time.Duration, autoGroups []string, usageLimit int, userID string, ephemeral bool) (*server.SetupKey, error)
	GetSetupKeyFunc                 func(accountID, userID, keyID string) (*server.SetupKey, error)
	GetAccountByUserOrAccountIdFunc func(userId, accountId, domain string) (*server.Account, error)
	GetUserFunc                     func(claims jwtclaims.AuthorizationClaims) (*server.User, error)
	ListUsersFunc                   func(accountID string) ([]*server.User, error)
	GetPeersFunc                    func(accountID, userID string) ([]*nbpeer.Peer, error)
	MarkPeerConnectedFunc           func(peerKey string, connected bool) error
	DeletePeerFunc                  func(accountID, peerKey, userID string) error
	GetNetworkMapFunc               func(peerKey string) (*server.NetworkMap, error)
	GetPeerNetworkFunc              func(peerKey string) (*server.Network, error)
	AddPeerFunc                     func(setupKey string, userId string, peer *nbpeer.Peer) (*nbpeer.Peer, *server.NetworkMap, error)
	GetGroupFunc                    func(accountID, groupID string) (*server.Group, error)
	SaveGroupFunc                   func(accountID, userID string, group *server.Group) error
	DeleteGroupFunc                 func(accountID, userId, groupID string) error
	ListGroupsFunc                  func(accountID string) ([]*server.Group, error)
	GroupAddPeerFunc                func(accountID, groupID, peerID string) error
	GroupDeletePeerFunc             func(accountID, groupID, peerID string) error
	GetRuleFunc                     func(accountID, ruleID, userID string) (*server.Rule, error)
	SaveRuleFunc                    func(accountID, userID string, rule *server.Rule) error
	DeleteRuleFunc                  func(accountID, ruleID, userID string) error
	ListRulesFunc                   func(accountID, userID string) ([]*server.Rule, error)
	GetPolicyFunc                   func(accountID, policyID, userID string) (*server.Policy, error)
	SavePolicyFunc                  func(accountID, userID string, policy *server.Policy) error
	DeletePolicyFunc                func(accountID, policyID, userID string) error
	ListPoliciesFunc                func(accountID, userID string) ([]*server.Policy, error)
	GetUsersFromAccountFunc         func(accountID, userID string) ([]*server.UserInfo, error)
	GetAccountFromPATFunc           func(pat string) (*server.Account, *server.User, *server.PersonalAccessToken, error)
	MarkPATUsedFunc                 func(pat string) error
	UpdatePeerMetaFunc              func(peerID string, meta nbpeer.PeerSystemMeta) error
	UpdatePeerSSHKeyFunc            func(peerID string, sshKey string) error
	UpdatePeerFunc                  func(accountID, userID string, peer *nbpeer.Peer) (*nbpeer.Peer, error)
	CreateRouteFunc                 func(accountID, prefix, peer string, peerGroups []string, description, netID string, masquerade bool, metric int, groups []string, enabled bool, userID string) (*route.Route, error)
	GetRouteFunc                    func(accountID, routeID, userID string) (*route.Route, error)
	SaveRouteFunc                   func(accountID, userID string, route *route.Route) error
	DeleteRouteFunc                 func(accountID, routeID, userID string) error
	ListRoutesFunc                  func(accountID, userID string) ([]*route.Route, error)
	SaveSetupKeyFunc                func(accountID string, key *server.SetupKey, userID string) (*server.SetupKey, error)
	ListSetupKeysFunc               func(accountID, userID string) ([]*server.SetupKey, error)
	SaveUserFunc                    func(accountID, userID string, user *server.User) (*server.UserInfo, error)
	SaveOrAddUserFunc               func(accountID, userID string, user *server.User, addIfNotExists bool) (*server.UserInfo, error)
	DeleteUserFunc                  func(accountID string, initiatorUserID string, targetUserID string) error
	CreatePATFunc                   func(accountID string, initiatorUserID string, targetUserId string, tokenName string, expiresIn int) (*server.PersonalAccessTokenGenerated, error)
	DeletePATFunc                   func(accountID string, initiatorUserID string, targetUserId string, tokenID string) error
	GetPATFunc                      func(accountID string, initiatorUserID string, targetUserId string, tokenID string) (*server.PersonalAccessToken, error)
	GetAllPATsFunc                  func(accountID string, initiatorUserID string, targetUserId string) ([]*server.PersonalAccessToken, error)
	GetNameServerGroupFunc          func(accountID, nsGroupID string) (*nbdns.NameServerGroup, error)
	CreateNameServerGroupFunc       func(accountID string, name, description string, nameServerList []nbdns.NameServer, groups []string, primary bool, domains []string, enabled bool, userID string, searchDomainsEnabled bool) (*nbdns.NameServerGroup, error)
	SaveNameServerGroupFunc         func(accountID, userID string, nsGroupToSave *nbdns.NameServerGroup) error
	DeleteNameServerGroupFunc       func(accountID, nsGroupID, userID string) error
	ListNameServerGroupsFunc        func(accountID string) ([]*nbdns.NameServerGroup, error)
	CreateUserFunc                  func(accountID, userID string, key *server.UserInfo) (*server.UserInfo, error)
	GetAccountFromTokenFunc         func(claims jwtclaims.AuthorizationClaims) (*server.Account, *server.User, error)
	CheckUserAccessByJWTGroupsFunc  func(claims jwtclaims.AuthorizationClaims) error
	DeleteAccountFunc               func(accountID, userID string) error
	GetDNSDomainFunc                func() string
	StoreEventFunc                  func(initiatorID, targetID, accountID string, activityID activity.Activity, meta map[string]any)
	GetEventsFunc                   func(accountID, userID string) ([]*activity.Event, error)
	GetDNSSettingsFunc              func(accountID, userID string) (*server.DNSSettings, error)
	SaveDNSSettingsFunc             func(accountID, userID string, dnsSettingsToSave *server.DNSSettings) error
	GetPeerFunc                     func(accountID, peerID, userID string) (*nbpeer.Peer, error)
	UpdateAccountSettingsFunc       func(accountID, userID string, newSettings *server.Settings) (*server.Account, error)
	LoginPeerFunc                   func(login server.PeerLogin) (*nbpeer.Peer, *server.NetworkMap, error)
	SyncPeerFunc                    func(sync server.PeerSync) (*nbpeer.Peer, *server.NetworkMap, error)
	InviteUserFunc                  func(accountID string, initiatorUserID string, targetUserEmail string) error
	GetAllConnectedPeersFunc        func() (map[string]struct{}, error)
	HasConnectedChannelFunc         func(peerID string) bool
	GetExternalCacheManagerFunc     func() server.ExternalCacheManager
}

func (*MockAccountManager) AddPeer

func (am *MockAccountManager) AddPeer(
	setupKey string,
	userId string,
	peer *nbpeer.Peer,
) (*nbpeer.Peer, *server.NetworkMap, error)

AddPeer mock implementation of AddPeer from server.AccountManager interface

func (*MockAccountManager) CheckUserAccessByJWTGroups

func (am *MockAccountManager) CheckUserAccessByJWTGroups(claims jwtclaims.AuthorizationClaims) error

func (*MockAccountManager) CreateNameServerGroup

func (am *MockAccountManager) CreateNameServerGroup(accountID string, name, description string, nameServerList []nbdns.NameServer, groups []string, primary bool, domains []string, enabled bool, userID string, searchDomainsEnabled bool) (*nbdns.NameServerGroup, error)

CreateNameServerGroup mocks CreateNameServerGroup of the AccountManager interface

func (*MockAccountManager) CreatePAT

func (am *MockAccountManager) CreatePAT(accountID string, initiatorUserID string, targetUserID string, name string, expiresIn int) (*server.PersonalAccessTokenGenerated, error)

CreatePAT mock implementation of GetPAT from server.AccountManager interface

func (*MockAccountManager) CreateRoute

func (am *MockAccountManager) CreateRoute(accountID, network, peerID string, peerGroups []string, description, netID string, masquerade bool, metric int, groups []string, enabled bool, userID string) (*route.Route, error)

CreateRoute mock implementation of CreateRoute from server.AccountManager interface

func (*MockAccountManager) CreateSetupKey

func (am *MockAccountManager) CreateSetupKey(
	accountID string,
	keyName string,
	keyType server.SetupKeyType,
	expiresIn time.Duration,
	autoGroups []string,
	usageLimit int,
	userID string,
	ephemeral bool,
) (*server.SetupKey, error)

CreateSetupKey mock implementation of CreateSetupKey from server.AccountManager interface

func (*MockAccountManager) CreateUser

func (am *MockAccountManager) CreateUser(accountID, userID string, invite *server.UserInfo) (*server.UserInfo, error)

CreateUser mocks CreateUser of the AccountManager interface

func (*MockAccountManager) DeleteAccount

func (am *MockAccountManager) DeleteAccount(accountID, userID string) error

DeleteAccount mock implementation of DeleteAccount from server.AccountManager interface

func (*MockAccountManager) DeleteGroup

func (am *MockAccountManager) DeleteGroup(accountId, userId, groupID string) error

DeleteGroup mock implementation of DeleteGroup from server.AccountManager interface

func (*MockAccountManager) DeleteNameServerGroup

func (am *MockAccountManager) DeleteNameServerGroup(accountID, nsGroupID, userID string) error

DeleteNameServerGroup mocks DeleteNameServerGroup of the AccountManager interface

func (*MockAccountManager) DeletePAT

func (am *MockAccountManager) DeletePAT(accountID string, initiatorUserID string, targetUserID string, tokenID string) error

DeletePAT mock implementation of DeletePAT from server.AccountManager interface

func (*MockAccountManager) DeletePeer

func (am *MockAccountManager) DeletePeer(accountID, peerID, userID string) error

DeletePeer mock implementation of DeletePeer from server.AccountManager interface

func (*MockAccountManager) DeletePolicy

func (am *MockAccountManager) DeletePolicy(accountID, policyID, userID string) error

DeletePolicy mock implementation of DeletePolicy from server.AccountManager interface

func (*MockAccountManager) DeleteRoute

func (am *MockAccountManager) DeleteRoute(accountID, routeID, userID string) error

DeleteRoute mock implementation of DeleteRoute from server.AccountManager interface

func (*MockAccountManager) DeleteRule

func (am *MockAccountManager) DeleteRule(accountID, ruleID, userID string) error

DeleteRule mock implementation of DeleteRule from server.AccountManager interface

func (*MockAccountManager) DeleteUser

func (am *MockAccountManager) DeleteUser(accountID string, initiatorUserID string, targetUserID string) error

DeleteUser mocks DeleteUser of the AccountManager interface

func (*MockAccountManager) GetAccountByUserOrAccountID

func (am *MockAccountManager) GetAccountByUserOrAccountID(
	userId, accountId, domain string,
) (*server.Account, error)

GetAccountByUserOrAccountID mock implementation of GetAccountByUserOrAccountID from server.AccountManager interface

func (*MockAccountManager) GetAccountFromPAT

func (am *MockAccountManager) GetAccountFromPAT(pat string) (*server.Account, *server.User, *server.PersonalAccessToken, error)

GetAccountFromPAT mock implementation of GetAccountFromPAT from server.AccountManager interface

func (*MockAccountManager) GetAccountFromToken

func (am *MockAccountManager) GetAccountFromToken(claims jwtclaims.AuthorizationClaims) (*server.Account, *server.User,
	error,
)

GetAccountFromToken mocks GetAccountFromToken of the AccountManager interface

func (*MockAccountManager) GetAllConnectedPeers

func (am *MockAccountManager) GetAllConnectedPeers() (map[string]struct{}, error)

GetAllConnectedPeers mocks GetAllConnectedPeers of the AccountManager interface

func (*MockAccountManager) GetAllPATs

func (am *MockAccountManager) GetAllPATs(accountID string, initiatorUserID string, targetUserID string) ([]*server.PersonalAccessToken, error)

GetAllPATs mock implementation of GetAllPATs from server.AccountManager interface

func (*MockAccountManager) GetDNSDomain

func (am *MockAccountManager) GetDNSDomain() string

GetDNSDomain mocks GetDNSDomain of the AccountManager interface

func (*MockAccountManager) GetDNSSettings

func (am *MockAccountManager) GetDNSSettings(accountID string, userID string) (*server.DNSSettings, error)

GetDNSSettings mocks GetDNSSettings of the AccountManager interface

func (*MockAccountManager) GetEvents

func (am *MockAccountManager) GetEvents(accountID, userID string) ([]*activity.Event, error)

GetEvents mocks GetEvents of the AccountManager interface

func (*MockAccountManager) GetExternalCacheManager

func (am *MockAccountManager) GetExternalCacheManager() server.ExternalCacheManager

GetExternalCacheManager mocks GetExternalCacheManager of the AccountManager interface

func (*MockAccountManager) GetGroup

func (am *MockAccountManager) GetGroup(accountID, groupID string) (*server.Group, error)

GetGroup mock implementation of GetGroup from server.AccountManager interface

func (*MockAccountManager) GetNameServerGroup

func (am *MockAccountManager) GetNameServerGroup(accountID, nsGroupID string) (*nbdns.NameServerGroup, error)

GetNameServerGroup mocks GetNameServerGroup of the AccountManager interface

func (*MockAccountManager) GetNetworkMap

func (am *MockAccountManager) GetNetworkMap(peerKey string) (*server.NetworkMap, error)

GetNetworkMap mock implementation of GetNetworkMap from server.AccountManager interface

func (*MockAccountManager) GetOrCreateAccountByUser

func (am *MockAccountManager) GetOrCreateAccountByUser(
	userId, domain string,
) (*server.Account, error)

GetOrCreateAccountByUser mock implementation of GetOrCreateAccountByUser from server.AccountManager interface

func (*MockAccountManager) GetPAT

func (am *MockAccountManager) GetPAT(accountID string, initiatorUserID string, targetUserID string, tokenID string) (*server.PersonalAccessToken, error)

GetPAT mock implementation of GetPAT from server.AccountManager interface

func (*MockAccountManager) GetPeer

func (am *MockAccountManager) GetPeer(accountID, peerID, userID string) (*nbpeer.Peer, error)

GetPeer mocks GetPeer of the AccountManager interface

func (*MockAccountManager) GetPeerNetwork

func (am *MockAccountManager) GetPeerNetwork(peerKey string) (*server.Network, error)

GetPeerNetwork mock implementation of GetPeerNetwork from server.AccountManager interface

func (*MockAccountManager) GetPeers

func (am *MockAccountManager) GetPeers(accountID, userID string) ([]*nbpeer.Peer, error)

GetPeers mocks GetPeers of the AccountManager interface

func (*MockAccountManager) GetPolicy

func (am *MockAccountManager) GetPolicy(accountID, policyID, userID string) (*server.Policy, error)

GetPolicy mock implementation of GetPolicy from server.AccountManager interface

func (*MockAccountManager) GetRoute

func (am *MockAccountManager) GetRoute(accountID, routeID, userID string) (*route.Route, error)

GetRoute mock implementation of GetRoute from server.AccountManager interface

func (*MockAccountManager) GetRule

func (am *MockAccountManager) GetRule(accountID, ruleID, userID string) (*server.Rule, error)

GetRule mock implementation of GetRule from server.AccountManager interface

func (*MockAccountManager) GetSetupKey

func (am *MockAccountManager) GetSetupKey(accountID, userID, keyID string) (*server.SetupKey, error)

GetSetupKey mocks GetSetupKey of the AccountManager interface

func (*MockAccountManager) GetUser

GetUser mock implementation of GetUser from server.AccountManager interface

func (*MockAccountManager) GetUsersFromAccount

func (am *MockAccountManager) GetUsersFromAccount(accountID string, userID string) ([]*server.UserInfo, error)

GetUsersFromAccount mock implementation of GetUsersFromAccount from server.AccountManager interface

func (*MockAccountManager) GroupAddPeer

func (am *MockAccountManager) GroupAddPeer(accountID, groupID, peerID string) error

GroupAddPeer mock implementation of GroupAddPeer from server.AccountManager interface

func (*MockAccountManager) GroupDeletePeer

func (am *MockAccountManager) GroupDeletePeer(accountID, groupID, peerID string) error

GroupDeletePeer mock implementation of GroupDeletePeer from server.AccountManager interface

func (*MockAccountManager) HasConnectedChannel

func (am *MockAccountManager) HasConnectedChannel(peerID string) bool

HasconnectedChannel mocks HasConnectedChannel of the AccountManager interface

func (*MockAccountManager) InviteUser

func (am *MockAccountManager) InviteUser(accountID string, initiatorUserID string, targetUserID string) error

func (*MockAccountManager) ListGroups

func (am *MockAccountManager) ListGroups(accountID string) ([]*server.Group, error)

ListGroups mock implementation of ListGroups from server.AccountManager interface

func (*MockAccountManager) ListNameServerGroups

func (am *MockAccountManager) ListNameServerGroups(accountID string) ([]*nbdns.NameServerGroup, error)

ListNameServerGroups mocks ListNameServerGroups of the AccountManager interface

func (*MockAccountManager) ListPolicies

func (am *MockAccountManager) ListPolicies(accountID, userID string) ([]*server.Policy, error)

ListPolicies mock implementation of ListPolicies from server.AccountManager interface

func (*MockAccountManager) ListRoutes

func (am *MockAccountManager) ListRoutes(accountID, userID string) ([]*route.Route, error)

ListRoutes mock implementation of ListRoutes from server.AccountManager interface

func (*MockAccountManager) ListRules

func (am *MockAccountManager) ListRules(accountID, userID string) ([]*server.Rule, error)

ListRules mock implementation of ListRules from server.AccountManager interface

func (*MockAccountManager) ListSetupKeys

func (am *MockAccountManager) ListSetupKeys(accountID, userID string) ([]*server.SetupKey, error)

ListSetupKeys mocks ListSetupKeys of the AccountManager interface

func (*MockAccountManager) ListUsers

func (am *MockAccountManager) ListUsers(accountID string) ([]*server.User, error)

func (*MockAccountManager) LoginPeer

func (am *MockAccountManager) LoginPeer(login server.PeerLogin) (*nbpeer.Peer, *server.NetworkMap, error)

LoginPeer mocks LoginPeer of the AccountManager interface

func (*MockAccountManager) MarkPATUsed

func (am *MockAccountManager) MarkPATUsed(pat string) error

MarkPATUsed mock implementation of MarkPATUsed from server.AccountManager interface

func (*MockAccountManager) MarkPeerConnected

func (am *MockAccountManager) MarkPeerConnected(peerKey string, connected bool) error

MarkPeerConnected mock implementation of MarkPeerConnected from server.AccountManager interface

func (*MockAccountManager) SaveDNSSettings

func (am *MockAccountManager) SaveDNSSettings(accountID string, userID string, dnsSettingsToSave *server.DNSSettings) error

SaveDNSSettings mocks SaveDNSSettings of the AccountManager interface

func (*MockAccountManager) SaveGroup

func (am *MockAccountManager) SaveGroup(accountID, userID string, group *server.Group) error

SaveGroup mock implementation of SaveGroup from server.AccountManager interface

func (*MockAccountManager) SaveNameServerGroup

func (am *MockAccountManager) SaveNameServerGroup(accountID, userID string, nsGroupToSave *nbdns.NameServerGroup) error

SaveNameServerGroup mocks SaveNameServerGroup of the AccountManager interface

func (*MockAccountManager) SaveOrAddUser

func (am *MockAccountManager) SaveOrAddUser(accountID, userID string, user *server.User, addIfNotExists bool) (*server.UserInfo, error)

SaveOrAddUser mocks SaveOrAddUser of the AccountManager interface

func (*MockAccountManager) SavePolicy

func (am *MockAccountManager) SavePolicy(accountID, userID string, policy *server.Policy) error

SavePolicy mock implementation of SavePolicy from server.AccountManager interface

func (*MockAccountManager) SaveRoute

func (am *MockAccountManager) SaveRoute(accountID, userID string, route *route.Route) error

SaveRoute mock implementation of SaveRoute from server.AccountManager interface

func (*MockAccountManager) SaveRule

func (am *MockAccountManager) SaveRule(accountID, userID string, rule *server.Rule) error

SaveRule mock implementation of SaveRule from server.AccountManager interface

func (*MockAccountManager) SaveSetupKey

func (am *MockAccountManager) SaveSetupKey(accountID string, key *server.SetupKey, userID string) (*server.SetupKey, error)

SaveSetupKey mocks SaveSetupKey of the AccountManager interface

func (*MockAccountManager) SaveUser

func (am *MockAccountManager) SaveUser(accountID, userID string, user *server.User) (*server.UserInfo, error)

SaveUser mocks SaveUser of the AccountManager interface

func (*MockAccountManager) StoreEvent

func (am *MockAccountManager) StoreEvent(initiatorID, targetID, accountID string, activityID activity.Activity, meta map[string]any)

StoreEvent mocks StoreEvent of the AccountManager interface

func (*MockAccountManager) SyncPeer

SyncPeer mocks SyncPeer of the AccountManager interface

func (*MockAccountManager) UpdateAccountSettings

func (am *MockAccountManager) UpdateAccountSettings(accountID, userID string, newSettings *server.Settings) (*server.Account, error)

UpdateAccountSettings mocks UpdateAccountSettings of the AccountManager interface

func (*MockAccountManager) UpdatePeer

func (am *MockAccountManager) UpdatePeer(accountID, userID string, peer *nbpeer.Peer) (*nbpeer.Peer, error)

UpdatePeer mocks UpdatePeerFunc function of the account manager

func (*MockAccountManager) UpdatePeerMeta

func (am *MockAccountManager) UpdatePeerMeta(peerID string, meta nbpeer.PeerSystemMeta) error

UpdatePeerMeta mock implementation of UpdatePeerMeta from server.AccountManager interface

func (*MockAccountManager) UpdatePeerSSHKey

func (am *MockAccountManager) UpdatePeerSSHKey(peerID string, sshKey string) error

UpdatePeerSSHKey mocks UpdatePeerSSHKey function of the account manager

Jump to

Keyboard shortcuts

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