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
- func RegularFileExists(filepath string) error
- func StartService(_ *logrus.Entry, programContext context.Context, cancel context.CancelFunc) error
- func ZipLogFiles(files []string) (string, error)
- type Config
- type DeviceHelperServer
- func (dhs *DeviceHelperServer) Configure(ctx context.Context, cfg *pb.Configuration) (*pb.ConfigureResponse, error)
- func (dhs *DeviceHelperServer) GetSerial(context.Context, *pb.GetSerialRequest) (*pb.GetSerialResponse, error)
- func (dhs *DeviceHelperServer) Ping(context.Context, *pb.PingRequest) (*pb.PingResponse, error)
- func (dhs *DeviceHelperServer) Teardown(ctx context.Context, req *pb.TeardownRequest) (*pb.TeardownResponse, error)
- func (dhs *DeviceHelperServer) Upgrade(context.Context, *pb.UpgradeRequest) (*pb.UpgradeResponse, error)
- type LinuxConfigurator
- func (c *LinuxConfigurator) Prerequisites() error
- func (c *LinuxConfigurator) SetupInterface(ctx context.Context, cfg *pb.Configuration) error
- func (c *LinuxConfigurator) SetupRoutes(ctx context.Context, gateways []*pb.Gateway) (int, error)
- func (c *LinuxConfigurator) SyncConf(ctx context.Context, cfg *pb.Configuration) error
- func (c *LinuxConfigurator) TeardownInterface(ctx context.Context) error
- type MockOSConfigurator
- func (_m *MockOSConfigurator) EXPECT() *MockOSConfigurator_Expecter
- func (_m *MockOSConfigurator) Prerequisites() error
- func (_m *MockOSConfigurator) SetupInterface(ctx context.Context, cfg *pb.Configuration) error
- func (_m *MockOSConfigurator) SetupRoutes(ctx context.Context, gateways []*pb.Gateway) (int, error)
- func (_m *MockOSConfigurator) SyncConf(ctx context.Context, cfg *pb.Configuration) error
- func (_m *MockOSConfigurator) TeardownInterface(ctx context.Context) error
- type MockOSConfigurator_Expecter
- func (_e *MockOSConfigurator_Expecter) Prerequisites() *MockOSConfigurator_Prerequisites_Call
- func (_e *MockOSConfigurator_Expecter) SetupInterface(ctx interface{}, cfg interface{}) *MockOSConfigurator_SetupInterface_Call
- func (_e *MockOSConfigurator_Expecter) SetupRoutes(ctx interface{}, gateways interface{}) *MockOSConfigurator_SetupRoutes_Call
- func (_e *MockOSConfigurator_Expecter) SyncConf(ctx interface{}, cfg interface{}) *MockOSConfigurator_SyncConf_Call
- func (_e *MockOSConfigurator_Expecter) TeardownInterface(ctx interface{}) *MockOSConfigurator_TeardownInterface_Call
- type MockOSConfigurator_Prerequisites_Call
- func (_c *MockOSConfigurator_Prerequisites_Call) Return(_a0 error) *MockOSConfigurator_Prerequisites_Call
- func (_c *MockOSConfigurator_Prerequisites_Call) Run(run func()) *MockOSConfigurator_Prerequisites_Call
- func (_c *MockOSConfigurator_Prerequisites_Call) RunAndReturn(run func() error) *MockOSConfigurator_Prerequisites_Call
- type MockOSConfigurator_SetupInterface_Call
- func (_c *MockOSConfigurator_SetupInterface_Call) Return(_a0 error) *MockOSConfigurator_SetupInterface_Call
- func (_c *MockOSConfigurator_SetupInterface_Call) Run(run func(ctx context.Context, cfg *pb.Configuration)) *MockOSConfigurator_SetupInterface_Call
- func (_c *MockOSConfigurator_SetupInterface_Call) RunAndReturn(run func(context.Context, *pb.Configuration) error) *MockOSConfigurator_SetupInterface_Call
- type MockOSConfigurator_SetupRoutes_Call
- func (_c *MockOSConfigurator_SetupRoutes_Call) Return(routesAdded int, err error) *MockOSConfigurator_SetupRoutes_Call
- func (_c *MockOSConfigurator_SetupRoutes_Call) Run(run func(ctx context.Context, gateways []*pb.Gateway)) *MockOSConfigurator_SetupRoutes_Call
- func (_c *MockOSConfigurator_SetupRoutes_Call) RunAndReturn(run func(context.Context, []*pb.Gateway) (int, error)) *MockOSConfigurator_SetupRoutes_Call
- type MockOSConfigurator_SyncConf_Call
- func (_c *MockOSConfigurator_SyncConf_Call) Return(_a0 error) *MockOSConfigurator_SyncConf_Call
- func (_c *MockOSConfigurator_SyncConf_Call) Run(run func(ctx context.Context, cfg *pb.Configuration)) *MockOSConfigurator_SyncConf_Call
- func (_c *MockOSConfigurator_SyncConf_Call) RunAndReturn(run func(context.Context, *pb.Configuration) error) *MockOSConfigurator_SyncConf_Call
- type MockOSConfigurator_TeardownInterface_Call
- func (_c *MockOSConfigurator_TeardownInterface_Call) Return(_a0 error) *MockOSConfigurator_TeardownInterface_Call
- func (_c *MockOSConfigurator_TeardownInterface_Call) Run(run func(ctx context.Context)) *MockOSConfigurator_TeardownInterface_Call
- func (_c *MockOSConfigurator_TeardownInterface_Call) RunAndReturn(run func(context.Context) error) *MockOSConfigurator_TeardownInterface_Call
- type OSConfigurator
- type TracedConfigurator
- func (tc *TracedConfigurator) Prerequisites() error
- func (tc *TracedConfigurator) SetupInterface(ctx context.Context, cfg *pb.Configuration) error
- func (tc *TracedConfigurator) SetupRoutes(ctx context.Context, gateways []*pb.Gateway) (int, error)
- func (tc *TracedConfigurator) SyncConf(ctx context.Context, cfg *pb.Configuration) error
- func (tc *TracedConfigurator) TeardownInterface(ctx context.Context) error
Constants ¶
const (
TunnelNetworkPrefix = "10.255.24."
)
Variables ¶
This section is empty.
Functions ¶
func RegularFileExists ¶
func StartService ¶
func ZipLogFiles ¶
Types ¶
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 (dhs *DeviceHelperServer) Configure( ctx context.Context, cfg *pb.Configuration, ) (*pb.ConfigureResponse, error)
func (*DeviceHelperServer) GetSerial ¶
func (dhs *DeviceHelperServer) GetSerial( context.Context, *pb.GetSerialRequest, ) (*pb.GetSerialResponse, error)
func (*DeviceHelperServer) Ping ¶
func (dhs *DeviceHelperServer) Ping( context.Context, *pb.PingRequest, ) (*pb.PingResponse, error)
func (*DeviceHelperServer) Teardown ¶
func (dhs *DeviceHelperServer) Teardown( ctx context.Context, req *pb.TeardownRequest, ) (*pb.TeardownResponse, error)
func (*DeviceHelperServer) Upgrade ¶
func (dhs *DeviceHelperServer) Upgrade( context.Context, *pb.UpgradeRequest, ) (*pb.UpgradeResponse, error)
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 (*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 ¶
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 (_m *MockOSConfigurator) EXPECT() *MockOSConfigurator_Expecter
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 ¶
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 ¶
func (_e *MockOSConfigurator_Expecter) Prerequisites() *MockOSConfigurator_Prerequisites_Call
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 ¶
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 (_c *MockOSConfigurator_Prerequisites_Call) Return(_a0 error) *MockOSConfigurator_Prerequisites_Call
func (*MockOSConfigurator_Prerequisites_Call) Run ¶
func (_c *MockOSConfigurator_Prerequisites_Call) Run(run func()) *MockOSConfigurator_Prerequisites_Call
func (*MockOSConfigurator_Prerequisites_Call) RunAndReturn ¶
func (_c *MockOSConfigurator_Prerequisites_Call) RunAndReturn(run func() error) *MockOSConfigurator_Prerequisites_Call
type MockOSConfigurator_SetupInterface_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 (_c *MockOSConfigurator_SetupInterface_Call) Return(_a0 error) *MockOSConfigurator_SetupInterface_Call
func (*MockOSConfigurator_SetupInterface_Call) Run ¶
func (_c *MockOSConfigurator_SetupInterface_Call) Run(run func(ctx context.Context, cfg *pb.Configuration)) *MockOSConfigurator_SetupInterface_Call
func (*MockOSConfigurator_SetupInterface_Call) RunAndReturn ¶
func (_c *MockOSConfigurator_SetupInterface_Call) RunAndReturn(run func(context.Context, *pb.Configuration) error) *MockOSConfigurator_SetupInterface_Call
type MockOSConfigurator_SetupRoutes_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 (_c *MockOSConfigurator_SetupRoutes_Call) Return(routesAdded int, err error) *MockOSConfigurator_SetupRoutes_Call
func (*MockOSConfigurator_SetupRoutes_Call) Run ¶
func (_c *MockOSConfigurator_SetupRoutes_Call) Run(run func(ctx context.Context, gateways []*pb.Gateway)) *MockOSConfigurator_SetupRoutes_Call
func (*MockOSConfigurator_SetupRoutes_Call) RunAndReturn ¶
func (_c *MockOSConfigurator_SetupRoutes_Call) RunAndReturn(run func(context.Context, []*pb.Gateway) (int, error)) *MockOSConfigurator_SetupRoutes_Call
type MockOSConfigurator_SyncConf_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 (_c *MockOSConfigurator_SyncConf_Call) Return(_a0 error) *MockOSConfigurator_SyncConf_Call
func (*MockOSConfigurator_SyncConf_Call) Run ¶
func (_c *MockOSConfigurator_SyncConf_Call) Run(run func(ctx context.Context, cfg *pb.Configuration)) *MockOSConfigurator_SyncConf_Call
func (*MockOSConfigurator_SyncConf_Call) RunAndReturn ¶
func (_c *MockOSConfigurator_SyncConf_Call) RunAndReturn(run func(context.Context, *pb.Configuration) error) *MockOSConfigurator_SyncConf_Call
type MockOSConfigurator_TeardownInterface_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 (_c *MockOSConfigurator_TeardownInterface_Call) Return(_a0 error) *MockOSConfigurator_TeardownInterface_Call
func (*MockOSConfigurator_TeardownInterface_Call) Run ¶
func (_c *MockOSConfigurator_TeardownInterface_Call) Run(run func(ctx context.Context)) *MockOSConfigurator_TeardownInterface_Call
func (*MockOSConfigurator_TeardownInterface_Call) RunAndReturn ¶
func (_c *MockOSConfigurator_TeardownInterface_Call) RunAndReturn(run func(context.Context) error) *MockOSConfigurator_TeardownInterface_Call
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) (routesAdded int, err error) Prerequisites() error }
type TracedConfigurator ¶
type TracedConfigurator struct { Wrapped OSConfigurator // contains filtered or unexported fields }
func NewTracedConfigurator ¶
func NewTracedConfigurator(w OSConfigurator) *TracedConfigurator
func (*TracedConfigurator) Prerequisites ¶
func (tc *TracedConfigurator) Prerequisites() error
func (*TracedConfigurator) SetupInterface ¶
func (tc *TracedConfigurator) SetupInterface(ctx context.Context, cfg *pb.Configuration) error
func (*TracedConfigurator) SetupRoutes ¶
func (*TracedConfigurator) SyncConf ¶
func (tc *TracedConfigurator) SyncConf(ctx context.Context, cfg *pb.Configuration) error
func (*TracedConfigurator) TeardownInterface ¶
func (tc *TracedConfigurator) TeardownInterface(ctx context.Context) error