service

package
v0.0.0-...-89602ce Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: BSD-3-Clause Imports: 28 Imported by: 0

Documentation

Overview

package service implements the core of bootstrapper

package service implements the core of bootstrapper

package service implements the core of bootstrapper

Index

Constants

View Source
const (
	PERIODIC_BOOTSTRAP_CHECK_INTERVAL = time.Minute * 15
	PREEXPIRY_BOOTSTRAP_INTERVAL      = time.Hour * 20
	BOOTSTRAP_RETRY_INTERVAL          = time.Second * 90

	PrivateKeyType          = "P384"
	CertificateECKeyType    = PrivateKeyType
	DefaultTLSBootstrapPort = 443
)

Variables

This section is empty.

Functions

func GetChallengeKey

func GetChallengeKey() (privKey interface{}, err error)

GetChallengeKey reads and returns the bootstrapper challenge key if present or creates and returns the key if the key file doesn't exist

Types

type BootstrapCompletion

type BootstrapCompletion *BootstrapCompletionStruct

BootstrapCompletion is a type sent to bootstrap channel (if any) on every bootstrapping attempt

type BootstrapCompletionStruct

type BootstrapCompletionStruct struct {
	HardwareId string
	Result     error
}

type Bootstrapper

type Bootstrapper struct {
	sync.RWMutex `json:"-"`

	// GW Hardware ID
	HardwareId string
	// CompletionChan is an optional chan which will receive BootstrapCompletion on every
	// successful or failed (Result ==/!= nil) bootstrap event
	CompletionChan chan interface{}
	// contains filtered or unexported fields
}

Bootstrapper - implementation of bootstrapper

func NewBootstrapper

func NewBootstrapper(bootstrapCompletionChan chan interface{}) *Bootstrapper

NewBootstrapper returns a new instance of bootstrapper with initialized configuration

func NewLocalBootstrapper

func NewLocalBootstrapper(bootstrapCompletionChan chan interface{}) *Bootstrapper

NewLocalBootstrapper returns a new instance of bootstrapper using local service with initialized configuration

func (*Bootstrapper) ForceBootstrap

func (b *Bootstrapper) ForceBootstrap() error

ForceBootstrap runs Bootstrapping sequence irregardless of GW certificate freshness

func (*Bootstrapper) GetBootstrapperCloudConnection

func (b *Bootstrapper) GetBootstrapperCloudConnection() (conn *grpc.ClientConn, err error)

GetBootstrapperCloudConnection initializes and returns Bootstrapper cloud grpc connection

func (*Bootstrapper) Initialize

func (b *Bootstrapper) Initialize() error

Initialize loads HW ID & challenge key and verifies it's validity

func (*Bootstrapper) PeriodicCheck

func (b *Bootstrapper) PeriodicCheck(now time.Time) (err error)

PeriodicCheck verifies GW certificate validity and bootstraps GW if needed

func (*Bootstrapper) RefreshConfigs

func (b *Bootstrapper) RefreshConfigs()

RefreshConfigs attempts to re-read all bootsrapper configs, it also invalidates challenge key cache: challengeKey

func (*Bootstrapper) Start

func (b *Bootstrapper) Start() error

Start loads challenge key and starts bootstrapper routine Start will block if successful and is supposed to run in its own routine Start will try to generate a new bootstrapper key if it doesn't exist only during an initial run & will try to only read it during periodic checks. It'll return an error if either initial run or periodic check fail, it's up to a caller to decide whether to fail on an error or retry

Jump to

Keyboard shortcuts

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