Documentation
¶
Overview ¶
Package errors provides errors for use in tests.
Index ¶
- Constants
- Variables
- func CreateSignature(privateKey *rsa.PrivateKey, data string) (string, error)
- func GenerateKeyPair() (*rsa.PrivateKey, ssh.PublicKey, error)
- func GenerateValidHeaders(privateKey *rsa.PrivateKey, data []byte) (http.Header, error)
- type ActiveVPN
- func (ActiveVPN) GetConnectionParameters() (vpn.ServerData, bool)
- func (ActiveVPN) IsActive() bool
- func (ActiveVPN) NetworkChanged() error
- func (ActiveVPN) Start(context.Context, vpn.Credentials, vpn.ServerData) error
- func (ActiveVPN) State() vpn.State
- func (ActiveVPN) Stop() error
- func (ActiveVPN) Tun() tunnel.T
- type AnalyticsConsentCheckerMock
- type CachingMapperMock
- type ConfigManager
- type DNSGetter
- type FailingVPN
- func (FailingVPN) GetConnectionParameters() (vpn.ServerData, bool)
- func (FailingVPN) IsActive() bool
- func (FailingVPN) NetworkChanged() error
- func (FailingVPN) Start(context.Context, vpn.Credentials, vpn.ServerData) error
- func (FailingVPN) State() vpn.State
- func (FailingVPN) Stop() error
- func (FailingVPN) Tun() tunnel.T
- type HTTPError
- type HTTPTestServer
- type Handler
- type MeshnetAndVPN
- type MockDaemonClient
- func (c MockDaemonClient) Cities(ctx context.Context, in *pb.CitiesRequest, opts ...grpc.CallOption) (*pb.ServerGroupsList, error)
- func (c MockDaemonClient) Countries(ctx context.Context, in *pb.Empty, opts ...grpc.CallOption) (*pb.ServerGroupsList, error)
- func (c MockDaemonClient) Groups(ctx context.Context, in *pb.Empty, opts ...grpc.CallOption) (*pb.ServerGroupsList, error)
- func (c MockDaemonClient) Ping(ctx context.Context, in *pb.Empty, opts ...grpc.CallOption) (*pb.PingResponse, error)
- type NotificationClientMock
- type RegisteredDomainsList
- type RegistrationCheckerMock
- type RegistryMock
- func (r *RegistryMock) Configure(token string, id uuid.UUID, peerID uuid.UUID, peer mesh.PeerUpdateRequest) error
- func (r *RegistryMock) GetPeerWithIdentifier(id string) *mesh.MachinePeer
- func (r *RegistryMock) Map(token string, self uuid.UUID, _ bool) (*mesh.MachineMap, error)
- func (*RegistryMock) NotifyNewTransfer(token string, self uuid.UUID, peer uuid.UUID, fileName string, fileCount int, ...) error
- func (*RegistryMock) Register(token string, self mesh.Machine) (*mesh.Machine, error)
- func (*RegistryMock) Unpair(token string, self uuid.UUID, peer uuid.UUID) error
- func (*RegistryMock) Unregister(token string, self uuid.UUID) error
- func (r *RegistryMock) Update(token string, id uuid.UUID, info mesh.MachineUpdateRequest) error
- type RemoteConfigMock
- type SysctlSetterMock
- type WorkingInactiveVPN
- func (WorkingInactiveVPN) GetConnectionParameters() (vpn.ServerData, bool)
- func (WorkingInactiveVPN) IsActive() bool
- func (WorkingInactiveVPN) NetworkChanged() error
- func (WorkingInactiveVPN) Start(context.Context, vpn.Credentials, vpn.ServerData) error
- func (WorkingInactiveVPN) State() vpn.State
- func (WorkingInactiveVPN) Stop() error
- func (WorkingInactiveVPN) Tun() tunnel.T
- type WorkingT
- type WorkingVPN
- func (w *WorkingVPN) GetConnectionParameters() (vpn.ServerData, bool)
- func (w *WorkingVPN) IsActive() bool
- func (w *WorkingVPN) NetworkChanged() error
- func (w *WorkingVPN) Start(context.Context, vpn.Credentials, vpn.ServerData) error
- func (w *WorkingVPN) State() vpn.State
- func (w *WorkingVPN) Stop() error
- func (*WorkingVPN) Tun() tunnel.T
Constants ¶
View Source
const ( StatsStart = iota StatsStop = iota StatsNetworkChange = iota )
Variables ¶
View Source
var DefaultNameserversV4 config.DNS = []string{
"103.86.96.100",
"103.86.99.100",
}
View Source
var En0Interface = net.Interface{ Index: 1, MTU: 5, Name: "en0", HardwareAddr: []byte("00:00:5e:00:53:01"), Flags: net.FlagMulticast, }
View Source
var En1Interface = net.Interface{ Index: 1, MTU: 5, Name: "en1", HardwareAddr: []byte("00:00:5e:00:53:01"), Flags: net.FlagMulticast, }
View Source
var ErrOnPurpose = errors.New("on purpose")
ErrOnPurpose is used in unit tests.
View Source
var TplNameserversV4 config.DNS = []string{
"103.86.96.96",
"103.86.99.99",
}
Functions ¶
func CreateSignature ¶
func CreateSignature(privateKey *rsa.PrivateKey, data string) (string, error)
CreateSignature signs data with RSA-SHA256 and encodes signature with Base64
func GenerateKeyPair ¶
func GenerateKeyPair() (*rsa.PrivateKey, ssh.PublicKey, error)
GenerateKeyPair generates a new RSA key pair
func GenerateValidHeaders ¶
GenerateValidHeaders generates HTTP Response headers that will be accepted in client side
Types ¶
type ActiveVPN ¶
type ActiveVPN struct{}
ActiveVPN stub of a github.com/NordSecurity/nordvpn-linux/daemon/vpn.VPN interface.
func (ActiveVPN) GetConnectionParameters ¶
func (ActiveVPN) GetConnectionParameters() (vpn.ServerData, bool)
func (ActiveVPN) NetworkChanged ¶
func (ActiveVPN) Start ¶
func (ActiveVPN) Start(context.Context, vpn.Credentials, vpn.ServerData) error
type AnalyticsConsentCheckerMock ¶
type AnalyticsConsentCheckerMock struct {
ConsentCompleted bool
}
func (*AnalyticsConsentCheckerMock) IsConsentFlowCompleted ¶
func (c *AnalyticsConsentCheckerMock) IsConsentFlowCompleted() bool
func (*AnalyticsConsentCheckerMock) PrepareDaemonIfConsentNotCompleted ¶
func (*AnalyticsConsentCheckerMock) PrepareDaemonIfConsentNotCompleted()
type CachingMapperMock ¶
type CachingMapperMock struct {
Value *mesh.MachineMap
Error error
}
func (*CachingMapperMock) Map ¶
func (m *CachingMapperMock) Map(_ string, _ uuid.UUID, _ bool) (*mesh.MachineMap, error)
type ConfigManager ¶
type ConfigManager struct {
Cfg *config.Config
SaveCallCount int
SaveErr error
LoadErr error
Saved bool
// contains filtered or unexported fields
}
func NewMockConfigManager ¶
func NewMockConfigManager() *ConfigManager
type DNSGetter ¶
type DNSGetter struct {
RegisteredDomains RegisteredDomainsList
Names []string
}
type FailingVPN ¶
type FailingVPN struct{}
FailingVPN stub of a github.com/NordSecurity/nordvpn-linux/daemon/vpn.VPN interface.
func (FailingVPN) GetConnectionParameters ¶
func (FailingVPN) GetConnectionParameters() (vpn.ServerData, bool)
func (FailingVPN) IsActive ¶
func (FailingVPN) IsActive() bool
func (FailingVPN) NetworkChanged ¶
func (FailingVPN) NetworkChanged() error
func (FailingVPN) Start ¶
func (FailingVPN) Start(context.Context, vpn.Credentials, vpn.ServerData) error
func (FailingVPN) State ¶
func (FailingVPN) State() vpn.State
func (FailingVPN) Stop ¶
func (FailingVPN) Stop() error
func (FailingVPN) Tun ¶
func (FailingVPN) Tun() tunnel.T
type HTTPTestServer ¶
type HTTPTestServer struct {
// contains filtered or unexported fields
}
func NewHTTPTestServer ¶
func NewHTTPTestServer(t *testing.T, handlers []Handler) *HTTPTestServer
func (*HTTPTestServer) Close ¶
func (s *HTTPTestServer) Close()
func (*HTTPTestServer) Running ¶
func (s *HTTPTestServer) Running() bool
func (*HTTPTestServer) Start ¶
func (s *HTTPTestServer) Start()
func (*HTTPTestServer) URL ¶
func (s *HTTPTestServer) URL() string
type MeshnetAndVPN ¶
type MeshnetAndVPN struct {
WorkingVPN
MeshEnableError error
}
func (*MeshnetAndVPN) Disable ¶
func (*MeshnetAndVPN) Disable() error
func (*MeshnetAndVPN) Refresh ¶
func (*MeshnetAndVPN) Refresh(mesh.MachineMap) error
type MockDaemonClient ¶
type MockDaemonClient struct {
pb.DaemonClient
CitiesResponse []*pb.ServerGroup
GroupsResponse []*pb.ServerGroup
CountriesResponse []*pb.ServerGroup
PingFn func() (*pb.PingResponse, error)
}
func (MockDaemonClient) Cities ¶
func (c MockDaemonClient) Cities(ctx context.Context, in *pb.CitiesRequest, opts ...grpc.CallOption) (*pb.ServerGroupsList, error)
func (MockDaemonClient) Countries ¶
func (c MockDaemonClient) Countries(ctx context.Context, in *pb.Empty, opts ...grpc.CallOption) (*pb.ServerGroupsList, error)
func (MockDaemonClient) Groups ¶
func (c MockDaemonClient) Groups(ctx context.Context, in *pb.Empty, opts ...grpc.CallOption) (*pb.ServerGroupsList, error)
func (MockDaemonClient) Ping ¶
func (c MockDaemonClient) Ping(ctx context.Context, in *pb.Empty, opts ...grpc.CallOption) (*pb.PingResponse, error)
type NotificationClientMock ¶
func (*NotificationClientMock) Revoke ¶
func (nc *NotificationClientMock) Revoke() bool
func (*NotificationClientMock) Start ¶
func (nc *NotificationClientMock) Start() error
func (*NotificationClientMock) Stop ¶
func (nc *NotificationClientMock) Stop() error
type RegisteredDomainsList ¶
type RegistrationCheckerMock ¶
type RegistrationCheckerMock struct {
// contains filtered or unexported fields
}
func (RegistrationCheckerMock) IsRegistrationInfoCorrect ¶
func (r RegistrationCheckerMock) IsRegistrationInfoCorrect() bool
func (RegistrationCheckerMock) Register ¶
func (r RegistrationCheckerMock) Register() error
type RegistryMock ¶
type RegistryMock struct {
CurrentMachine mesh.Machine
Peers mesh.MachinePeers
LocalPeers mesh.Machines
MapErr error
ConfigureErr error
UpdateErr error
}
func (*RegistryMock) Configure ¶
func (r *RegistryMock) Configure(token string, id uuid.UUID, peerID uuid.UUID, peer mesh.PeerUpdateRequest) error
func (*RegistryMock) GetPeerWithIdentifier ¶
func (r *RegistryMock) GetPeerWithIdentifier(id string) *mesh.MachinePeer
func (*RegistryMock) Map ¶
func (r *RegistryMock) Map(token string, self uuid.UUID, _ bool) (*mesh.MachineMap, error)
func (*RegistryMock) NotifyNewTransfer ¶
func (*RegistryMock) Unregister ¶
func (*RegistryMock) Unregister(token string, self uuid.UUID) error
func (*RegistryMock) Update ¶
func (r *RegistryMock) Update(token string, id uuid.UUID, info mesh.MachineUpdateRequest) error
type RemoteConfigMock ¶
func NewRemoteConfigMock ¶
func NewRemoteConfigMock() *RemoteConfigMock
func (*RemoteConfigMock) GetFeatureParam ¶
func (r *RemoteConfigMock) GetFeatureParam(_, _ string) (string, error)
func (*RemoteConfigMock) GetNordWhisperEnabled ¶
func (r *RemoteConfigMock) GetNordWhisperEnabled() (bool, error)
func (*RemoteConfigMock) GetTelioConfig ¶
func (r *RemoteConfigMock) GetTelioConfig() (string, error)
func (*RemoteConfigMock) IsFeatureEnabled ¶
func (r *RemoteConfigMock) IsFeatureEnabled(string) bool
func (*RemoteConfigMock) LoadConfig ¶
func (r *RemoteConfigMock) LoadConfig() error
type SysctlSetterMock ¶
func (*SysctlSetterMock) Set ¶
func (s *SysctlSetterMock) Set() error
func (*SysctlSetterMock) Unset ¶
func (s *SysctlSetterMock) Unset() error
type WorkingInactiveVPN ¶
type WorkingInactiveVPN struct{}
func (WorkingInactiveVPN) GetConnectionParameters ¶
func (WorkingInactiveVPN) GetConnectionParameters() (vpn.ServerData, bool)
func (WorkingInactiveVPN) IsActive ¶
func (WorkingInactiveVPN) IsActive() bool
func (WorkingInactiveVPN) NetworkChanged ¶
func (WorkingInactiveVPN) NetworkChanged() error
func (WorkingInactiveVPN) Start ¶
func (WorkingInactiveVPN) Start(context.Context, vpn.Credentials, vpn.ServerData) error
func (WorkingInactiveVPN) State ¶
func (WorkingInactiveVPN) State() vpn.State
func (WorkingInactiveVPN) Stop ¶
func (WorkingInactiveVPN) Stop() error
func (WorkingInactiveVPN) Tun ¶
func (WorkingInactiveVPN) Tun() tunnel.T
type WorkingT ¶
type WorkingT struct{}
WorkingT stub of a github.com/NordSecurity/nordvpn-linux/tunnel.T interface.
func (WorkingT) TransferRates ¶
func (WorkingT) TransferRates() (tunnel.Statistics, error)
type WorkingVPN ¶
type WorkingVPN struct {
StartErr error
ErrNetworkChanges error
ExecutionStats [statsLastValue]int
// contains filtered or unexported fields
}
WorkingVPN stub of a github.com/NordSecurity/nordvpn-linux/daemon/vpn.VPN interface.
func (*WorkingVPN) GetConnectionParameters ¶
func (w *WorkingVPN) GetConnectionParameters() (vpn.ServerData, bool)
func (*WorkingVPN) IsActive ¶
func (w *WorkingVPN) IsActive() bool
func (*WorkingVPN) NetworkChanged ¶
func (w *WorkingVPN) NetworkChanged() error
func (*WorkingVPN) Start ¶
func (w *WorkingVPN) Start(context.Context, vpn.Credentials, vpn.ServerData) error
func (*WorkingVPN) State ¶
func (w *WorkingVPN) State() vpn.State
func (*WorkingVPN) Stop ¶
func (w *WorkingVPN) Stop() error
func (*WorkingVPN) Tun ¶
func (*WorkingVPN) Tun() tunnel.T
Source Files
¶
Click to show internal directories.
Click to hide internal directories.