mock_server

package
v0.21.7 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: BSD-3-Clause Imports: 10 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)
}

func (ManagementServiceServerMock) GetDeviceAuthorizationFlow

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

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) (*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)
	AccountExistsFunc               func(accountId string) (*bool, error)
	GetPeerByKeyFunc                func(peerKey string) (*server.Peer, error)
	GetPeersFunc                    func(accountID, userID string) ([]*server.Peer, error)
	MarkPeerConnectedFunc           func(peerKey string, connected bool) error
	DeletePeerFunc                  func(accountID, peerKey, userID string) (*server.Peer, error)
	GetPeerByIPFunc                 func(accountId string, peerIP string) (*server.Peer, error)
	GetNetworkMapFunc               func(peerKey string) (*server.NetworkMap, error)
	GetPeerNetworkFunc              func(peerKey string) (*server.Network, error)
	AddPeerFunc                     func(setupKey string, userId string, peer *server.Peer) (*server.Peer, *server.NetworkMap, error)
	GetGroupFunc                    func(accountID, groupID string) (*server.Group, error)
	SaveGroupFunc                   func(accountID, userID string, group *server.Group) error
	UpdateGroupFunc                 func(accountID string, groupID string, operations []server.GroupUpdateOperation) (*server.Group, error)
	DeleteGroupFunc                 func(accountID, groupID string) error
	ListGroupsFunc                  func(accountID string) ([]*server.Group, error)
	GroupAddPeerFunc                func(accountID, groupID, peerKey string) error
	GroupDeletePeerFunc             func(accountID, groupID, peerKey string) error
	GroupListPeersFunc              func(accountID, groupID string) ([]*server.Peer, 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 server.PeerSystemMeta) error
	UpdatePeerSSHKeyFunc            func(peerID string, sshKey string) error
	UpdatePeerFunc                  func(accountID, userID string, peer *server.Peer) (*server.Peer, error)
	CreateRouteFunc                 func(accountID string, prefix, peer, 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
	UpdateRouteFunc                 func(accountID string, routeID string, operations []server.RouteUpdateOperation) (*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)
	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) (*nbdns.NameServerGroup, error)
	SaveNameServerGroupFunc         func(accountID, userID string, nsGroupToSave *nbdns.NameServerGroup) error
	UpdateNameServerGroupFunc       func(accountID, nsGroupID, userID string, operations []server.NameServerGroupUpdateOperation) (*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)
	GetDNSDomainFunc                func() string
	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) (*server.Peer, error)
	UpdateAccountSettingsFunc       func(accountID, userID string, newSettings *server.Settings) (*server.Account, error)
	LoginPeerFunc                   func(login server.PeerLogin) (*server.Peer, *server.NetworkMap, error)
	SyncPeerFunc                    func(sync server.PeerSync) (*server.Peer, *server.NetworkMap, error)
}

func (*MockAccountManager) AccountExists

func (am *MockAccountManager) AccountExists(accountId string) (*bool, error)

AccountExists mock implementation of AccountExists from server.AccountManager interface

func (*MockAccountManager) AddPeer

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

AddPeer mock implementation of AddPeer from server.AccountManager interface

func (*MockAccountManager) CreateNameServerGroup added in v0.9.8

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

CreateNameServerGroup mocks CreateNameServerGroup of the AccountManager interface

func (*MockAccountManager) CreatePAT added in v0.14.6

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 added in v0.8.9

func (am *MockAccountManager) CreateRoute(accountID string, network, peerID, 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 added in v0.9.2

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

CreateSetupKey mock implementation of CreateSetupKey from server.AccountManager interface

func (*MockAccountManager) CreateUser added in v0.9.8

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

CreateUser mocks CreateUser of the AccountManager interface

func (*MockAccountManager) DeleteGroup

func (am *MockAccountManager) DeleteGroup(accountID, groupID string) error

DeleteGroup mock implementation of DeleteGroup from server.AccountManager interface

func (*MockAccountManager) DeleteNameServerGroup added in v0.9.8

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

DeleteNameServerGroup mocks DeleteNameServerGroup of the AccountManager interface

func (*MockAccountManager) DeletePAT added in v0.14.5

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) (*server.Peer, error)

DeletePeer mock implementation of DeletePeer from server.AccountManager interface

func (*MockAccountManager) DeletePolicy added in v0.14.5

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

DeletePolicy mock implementation of DeletePolicy from server.AccountManager interface

func (*MockAccountManager) DeleteRoute added in v0.8.9

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 added in v0.17.0

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

DeleteUser mocks DeleteUser of the AccountManager interface

func (*MockAccountManager) GetAccountByUserOrAccountID added in v0.10.7

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

GetAccountByUserOrAccountID mock implementation of GetAccountByUserOrAccountID from server.AccountManager interface

func (*MockAccountManager) GetAccountFromPAT added in v0.14.5

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 added in v0.9.8

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

GetAccountFromToken mocks GetAccountFromToken of the AccountManager interface

func (*MockAccountManager) GetAllPATs added in v0.14.6

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 added in v0.10.10

func (am *MockAccountManager) GetDNSDomain() string

GetDNSDomain mocks GetDNSDomain of the AccountManager interface

func (*MockAccountManager) GetDNSSettings added in v0.12.0

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

GetDNSSettings mocks GetDNSSettings of the AccountManager interface

func (*MockAccountManager) GetEvents added in v0.12.0

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

GetEvents mocks GetEvents 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 added in v0.9.8

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 added in v0.14.6

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) (*server.Peer, error)

GetPeer mocks GetPeer of the AccountManager interface

func (*MockAccountManager) GetPeerByIP

func (am *MockAccountManager) GetPeerByIP(accountId string, peerIP string) (*server.Peer, error)

GetPeerByIP mock implementation of GetPeerByIP from server.AccountManager interface

func (*MockAccountManager) GetPeerByKey added in v0.13.0

func (am *MockAccountManager) GetPeerByKey(peerKey string) (*server.Peer, error)

GetPeerByKey mocks implementation of GetPeerByKey from server.AccountManager interface

func (*MockAccountManager) GetPeerNetwork added in v0.8.0

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

GetPeerNetwork mock implementation of GetPeerNetwork from server.AccountManager interface

func (*MockAccountManager) GetPeers added in v0.10.5

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

GetPeers mocks GetPeers of the AccountManager interface

func (*MockAccountManager) GetPolicy added in v0.14.5

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

GetPolicy mock implementation of GetPolicy from server.AccountManager interface

func (*MockAccountManager) GetRoute added in v0.8.9

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 added in v0.9.2

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

GetSetupKey mocks GetSetupKey of the AccountManager interface

func (*MockAccountManager) GetUser added in v0.20.0

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, peerKey string) error

GroupAddPeer mock implementation of GroupAddPeer from server.AccountManager interface

func (*MockAccountManager) GroupDeletePeer

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

GroupDeletePeer mock implementation of GroupDeletePeer from server.AccountManager interface

func (*MockAccountManager) GroupListPeers

func (am *MockAccountManager) GroupListPeers(accountID, groupID string) ([]*server.Peer, error)

GroupListPeers mock implementation of GroupListPeers from server.AccountManager interface

func (*MockAccountManager) ListGroups

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

ListGroups mock implementation of ListGroups from server.AccountManager interface

func (*MockAccountManager) ListNameServerGroups added in v0.9.8

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

ListNameServerGroups mocks ListNameServerGroups of the AccountManager interface

func (*MockAccountManager) ListPolicies added in v0.14.5

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

ListPolicies mock implementation of ListPolicies from server.AccountManager interface

func (*MockAccountManager) ListRoutes added in v0.8.9

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 added in v0.9.2

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

ListSetupKeys mocks ListSetupKeys of the AccountManager interface

func (*MockAccountManager) LoginPeer added in v0.14.3

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

LoginPeer mocks LoginPeer of the AccountManager interface

func (*MockAccountManager) MarkPATUsed added in v0.15.0

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 added in v0.12.0

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 added in v0.9.8

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

SaveNameServerGroup mocks SaveNameServerGroup of the AccountManager interface

func (*MockAccountManager) SavePolicy added in v0.14.5

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

SavePolicy mock implementation of SavePolicy from server.AccountManager interface

func (*MockAccountManager) SaveRoute added in v0.8.9

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 added in v0.9.2

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

SaveSetupKey mocks SaveSetupKey of the AccountManager interface

func (*MockAccountManager) SaveUser added in v0.9.4

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

SaveUser mocks SaveUser of the AccountManager interface

func (*MockAccountManager) SyncPeer added in v0.14.3

SyncPeer mocks SyncPeer of the AccountManager interface

func (*MockAccountManager) UpdateAccountSettings added in v0.14.0

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

UpdateAccountSettings mocks UpdateAccountSettings of the AccountManager interface

func (*MockAccountManager) UpdateGroup added in v0.7.0

func (am *MockAccountManager) UpdateGroup(accountID string, groupID string, operations []server.GroupUpdateOperation) (*server.Group, error)

UpdateGroup mock implementation of UpdateGroup from server.AccountManager interface

func (*MockAccountManager) UpdateNameServerGroup added in v0.9.8

func (am *MockAccountManager) UpdateNameServerGroup(accountID, nsGroupID, userID string, operations []server.NameServerGroupUpdateOperation) (*nbdns.NameServerGroup, error)

UpdateNameServerGroup mocks UpdateNameServerGroup of the AccountManager interface

func (*MockAccountManager) UpdatePeer added in v0.8.0

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

UpdatePeer mocks UpdatePeerFunc function of the account manager

func (*MockAccountManager) UpdatePeerMeta

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

UpdatePeerMeta mock implementation of UpdatePeerMeta from server.AccountManager interface

func (*MockAccountManager) UpdatePeerSSHKey added in v0.8.0

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

UpdatePeerSSHKey mocks UpdatePeerSSHKey function of the account manager

func (*MockAccountManager) UpdateRoute added in v0.8.9

func (am *MockAccountManager) UpdateRoute(accountID, ruleID string, operations []server.RouteUpdateOperation) (*route.Route, error)

UpdateRoute mock implementation of UpdateRoute from server.AccountManager interface

Jump to

Keyboard shortcuts

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