helper

package
v0.0.0-...-f174eeb Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

device-helper is responsible for: - running the WireGuard process - configuring the network tunnel interface - synchronizing WireGuard with the provided config - setting up the required routes

Index

Constants

View Source
const (
	TunnelNetworkPrefix = "10.255.24."
)

Variables

This section is empty.

Functions

func RegularFileExists

func RegularFileExists(filepath string) error

func StartService

func StartService(_ *logrus.Entry, programContext context.Context, cancel context.CancelFunc) error

func ZipLogFiles

func ZipLogFiles(files []string) (string, error)

Types

type Config

type Config struct {
	Interface           string
	LogLevel            string
	WireGuardConfigPath string
}

type DeviceHelperServer

type DeviceHelperServer struct {
	pb.UnimplementedDeviceHelperServer
	// contains filtered or unexported fields
}

func NewDeviceHelperServer

func NewDeviceHelperServer(log *logrus.Entry, config Config, osConfigurator OSConfigurator) *DeviceHelperServer

func (*DeviceHelperServer) Configure

func (*DeviceHelperServer) GetSerial

func (*DeviceHelperServer) Teardown

func (*DeviceHelperServer) Upgrade

type LinuxConfigurator

type LinuxConfigurator struct {
	// contains filtered or unexported fields
}

func New

func New(helperConfig Config) *LinuxConfigurator

func (*LinuxConfigurator) Prerequisites

func (c *LinuxConfigurator) Prerequisites() error

func (*LinuxConfigurator) SetupInterface

func (c *LinuxConfigurator) SetupInterface(ctx context.Context, cfg *pb.Configuration) error

func (*LinuxConfigurator) SetupRoutes

func (c *LinuxConfigurator) SetupRoutes(ctx context.Context, gateways []*pb.Gateway) error

func (*LinuxConfigurator) SyncConf

func (c *LinuxConfigurator) SyncConf(ctx context.Context, cfg *pb.Configuration) error

func (*LinuxConfigurator) TeardownInterface

func (c *LinuxConfigurator) TeardownInterface(ctx context.Context) error

type MockOSConfigurator

type MockOSConfigurator struct {
	mock.Mock
}

MockOSConfigurator is an autogenerated mock type for the OSConfigurator type

func NewMockOSConfigurator

func NewMockOSConfigurator(t interface {
	mock.TestingT
	Cleanup(func())
},
) *MockOSConfigurator

NewMockOSConfigurator creates a new instance of MockOSConfigurator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockOSConfigurator) EXPECT

func (*MockOSConfigurator) Prerequisites

func (_m *MockOSConfigurator) Prerequisites() error

Prerequisites provides a mock function with given fields:

func (*MockOSConfigurator) SetupInterface

func (_m *MockOSConfigurator) SetupInterface(ctx context.Context, cfg *pb.Configuration) error

SetupInterface provides a mock function with given fields: ctx, cfg

func (*MockOSConfigurator) SetupRoutes

func (_m *MockOSConfigurator) SetupRoutes(ctx context.Context, gateways []*pb.Gateway) error

SetupRoutes provides a mock function with given fields: ctx, gateways

func (*MockOSConfigurator) SyncConf

func (_m *MockOSConfigurator) SyncConf(ctx context.Context, cfg *pb.Configuration) error

SyncConf provides a mock function with given fields: ctx, cfg

func (*MockOSConfigurator) TeardownInterface

func (_m *MockOSConfigurator) TeardownInterface(ctx context.Context) error

TeardownInterface provides a mock function with given fields: ctx

type MockOSConfigurator_Expecter

type MockOSConfigurator_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockOSConfigurator_Expecter) Prerequisites

Prerequisites is a helper method to define mock.On call

func (*MockOSConfigurator_Expecter) SetupInterface

func (_e *MockOSConfigurator_Expecter) SetupInterface(ctx interface{}, cfg interface{}) *MockOSConfigurator_SetupInterface_Call

SetupInterface is a helper method to define mock.On call

  • ctx context.Context
  • cfg *pb.Configuration

func (*MockOSConfigurator_Expecter) SetupRoutes

func (_e *MockOSConfigurator_Expecter) SetupRoutes(ctx interface{}, gateways interface{}) *MockOSConfigurator_SetupRoutes_Call

SetupRoutes is a helper method to define mock.On call

  • ctx context.Context
  • gateways []*pb.Gateway

func (*MockOSConfigurator_Expecter) SyncConf

func (_e *MockOSConfigurator_Expecter) SyncConf(ctx interface{}, cfg interface{}) *MockOSConfigurator_SyncConf_Call

SyncConf is a helper method to define mock.On call

  • ctx context.Context
  • cfg *pb.Configuration

func (*MockOSConfigurator_Expecter) TeardownInterface

func (_e *MockOSConfigurator_Expecter) TeardownInterface(ctx interface{}) *MockOSConfigurator_TeardownInterface_Call

TeardownInterface is a helper method to define mock.On call

  • ctx context.Context

type MockOSConfigurator_Prerequisites_Call

type MockOSConfigurator_Prerequisites_Call struct {
	*mock.Call
}

MockOSConfigurator_Prerequisites_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Prerequisites'

func (*MockOSConfigurator_Prerequisites_Call) Return

func (*MockOSConfigurator_Prerequisites_Call) Run

func (*MockOSConfigurator_Prerequisites_Call) RunAndReturn

type MockOSConfigurator_SetupInterface_Call

type MockOSConfigurator_SetupInterface_Call struct {
	*mock.Call
}

MockOSConfigurator_SetupInterface_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupInterface'

func (*MockOSConfigurator_SetupInterface_Call) Return

func (*MockOSConfigurator_SetupInterface_Call) Run

func (*MockOSConfigurator_SetupInterface_Call) RunAndReturn

type MockOSConfigurator_SetupRoutes_Call

type MockOSConfigurator_SetupRoutes_Call struct {
	*mock.Call
}

MockOSConfigurator_SetupRoutes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetupRoutes'

func (*MockOSConfigurator_SetupRoutes_Call) Return

func (*MockOSConfigurator_SetupRoutes_Call) Run

func (*MockOSConfigurator_SetupRoutes_Call) RunAndReturn

type MockOSConfigurator_SyncConf_Call

type MockOSConfigurator_SyncConf_Call struct {
	*mock.Call
}

MockOSConfigurator_SyncConf_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SyncConf'

func (*MockOSConfigurator_SyncConf_Call) Return

func (*MockOSConfigurator_SyncConf_Call) Run

func (*MockOSConfigurator_SyncConf_Call) RunAndReturn

type MockOSConfigurator_TeardownInterface_Call

type MockOSConfigurator_TeardownInterface_Call struct {
	*mock.Call
}

MockOSConfigurator_TeardownInterface_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TeardownInterface'

func (*MockOSConfigurator_TeardownInterface_Call) Return

func (*MockOSConfigurator_TeardownInterface_Call) Run

func (*MockOSConfigurator_TeardownInterface_Call) RunAndReturn

type OSConfigurator

type OSConfigurator interface {
	SetupInterface(ctx context.Context, cfg *pb.Configuration) error
	TeardownInterface(ctx context.Context) error
	SyncConf(ctx context.Context, cfg *pb.Configuration) error
	SetupRoutes(ctx context.Context, gateways []*pb.Gateway) error
	Prerequisites() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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