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
- type ConfigManager
- type DNSGetter
- type FailingVPN
- type MeshnetAndVPN
- type PKVault
- type RegisteredDomainsList
- 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) List(token string, self uuid.UUID) (mesh.MachinePeers, error)
- func (r *RegistryMock) Local(token string) (mesh.Machines, error)
- func (r *RegistryMock) Map(token string, self uuid.UUID) (*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 SysctlSetterMock
- type WorkingIPv6T
- type WorkingInactiveVPN
- type WorkingT
- type WorkingVPN
Constants ¶
const ( StatsStart = iota StatsStop = iota StatsNetworkChange = iota )
Variables ¶
var DefaultNameserversV4 config.DNS = []string{
"103.86.96.100",
"103.86.99.100",
}
var DefaultNameserversV6 config.DNS = []string{
"2400:bb40:4444::100",
"2400:bb40:8888::100",
}
var En0Interface = net.Interface{ Index: 1, MTU: 5, Name: "en0", HardwareAddr: []byte("00:00:5e:00:53:01"), Flags: net.FlagMulticast, }
var En1Interface = net.Interface{ Index: 1, MTU: 5, Name: "en1", HardwareAddr: []byte("00:00:5e:00:53:01"), Flags: net.FlagMulticast, }
var ErrOnPurpose = errors.New("on purpose")
ErrOnPurpose is used in unit tests.
var TplNameserversV4 config.DNS = []string{
"103.86.96.96",
"103.86.99.99",
}
var TplNameserversV6 config.DNS = []string{
"2400:bb40:4444::103",
"2400:bb40:8888::103",
}
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) NetworkChanged ¶
func (ActiveVPN) Start ¶
func (ActiveVPN) Start(vpn.Credentials, vpn.ServerData) error
type ConfigManager ¶
func NewMockConfigManager ¶
func NewMockConfigManager() *ConfigManager
func (*ConfigManager) Reset ¶
func (m *ConfigManager) Reset() error
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) IsActive ¶
func (FailingVPN) IsActive() bool
func (FailingVPN) NetworkChanged ¶
func (FailingVPN) NetworkChanged() error
func (FailingVPN) Start ¶
func (FailingVPN) Start(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 MeshnetAndVPN ¶
type MeshnetAndVPN struct { WorkingVPN MeshEnableError error }
func (*MeshnetAndVPN) Disable ¶
func (*MeshnetAndVPN) Disable() error
func (*MeshnetAndVPN) Refresh ¶
func (*MeshnetAndVPN) Refresh(mesh.MachineMap) error
type RegisteredDomainsList ¶
type RegistryMock ¶
type RegistryMock struct { CurrentMachine mesh.Machine Peers mesh.MachinePeers LocalPeers mesh.Machines ListErr 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) List ¶
func (r *RegistryMock) List(token string, self uuid.UUID) (mesh.MachinePeers, error)
func (*RegistryMock) Map ¶
func (r *RegistryMock) Map(token string, self uuid.UUID) (*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 SysctlSetterMock ¶
type SysctlSetterMock struct {
// contains filtered or unexported fields
}
func (*SysctlSetterMock) Set ¶
func (s *SysctlSetterMock) Set() error
func (*SysctlSetterMock) Unset ¶
func (s *SysctlSetterMock) Unset() error
type WorkingIPv6T ¶
type WorkingIPv6T struct{}
WorkingIPv6T stub of a github.com/NordSecurity/nordvpn-linux/tunnel.T interface.
func (WorkingIPv6T) IPs ¶
func (WorkingIPv6T) IPs() []netip.Addr
func (WorkingIPv6T) Interface ¶
func (WorkingIPv6T) Interface() net.Interface
func (WorkingIPv6T) TransferRates ¶
func (WorkingIPv6T) TransferRates() (tunnel.Statistics, error)
type WorkingInactiveVPN ¶
type WorkingInactiveVPN struct{}
func (WorkingInactiveVPN) IsActive ¶
func (WorkingInactiveVPN) IsActive() bool
func (WorkingInactiveVPN) NetworkChanged ¶
func (WorkingInactiveVPN) NetworkChanged() error
func (WorkingInactiveVPN) Start ¶
func (WorkingInactiveVPN) Start(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) IsActive ¶
func (w *WorkingVPN) IsActive() bool
func (*WorkingVPN) NetworkChanged ¶
func (w *WorkingVPN) NetworkChanged() error
func (*WorkingVPN) Start ¶
func (w *WorkingVPN) Start(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