register

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const RegistrationDeadlineSeconds = 10

Variables

This section is empty.

Functions

func SendJSONData

func SendJSONData(conn *websocket.Conn, msgType MessageType, data interface{}) error

SendJSONData transmits json encoded data to the websocket connection, attaching to it msgType. It needs a `MsgReady` reply on the websocket channel in order to report a successful transmission

func WriteMessage

func WriteMessage(conn *websocket.Conn, msgType MessageType, data []byte) error

WriteMessage attaches msgType to the actual data before sending it to the websocket connection

Types

type Client added in v1.3.0

type Client interface {
	Register(reg elementalv1.Registration, caCert []byte, state *State) ([]byte, error)
}

func NewClient added in v1.3.0

func NewClient() Client

type ErrorMessage added in v1.1.1

type ErrorMessage struct {
	Message string `json:"message,omitempty" yaml:"message"`
}

func NewErrorMessage added in v1.1.1

func NewErrorMessage(err error) ErrorMessage

type MessageType

type MessageType byte
const (
	MsgUndefined MessageType = iota
	MsgReady
	MsgSmbios
	MsgLabels
	MsgGet
	MsgVersion                 // v1.1.0
	MsgSystemData              // v1.1.1
	MsgConfig                  // v1.1.1
	MsgError                   // v1.1.1
	MsgAnnotations             // v1.1.4
	MsgUpdate                  // v1.2.6
	MsgLast        = MsgUpdate // MsgLast must point to the last message
)

func ReadMessage

func ReadMessage(conn *websocket.Conn) (MessageType, []byte, error)

ReadMessage reads from the websocket connection returning the MessageType and the actual data

func (MessageType) String

func (mt MessageType) String() string

type State added in v1.3.0

type State struct {
	InitialRegistration time.Time `yaml:"initialRegistration,omitempty"`
	LastUpdate          time.Time `yaml:"lastUpdate,omitempty"`
	EmulatedTPM         bool      `yaml:"emulatedTPM,omitempty"`
	EmulatedTPMSeed     int64     `yaml:"emulatedTPMSeed,omitempty"`
}

func (*State) HasLastUpdateElapsed added in v1.3.0

func (s *State) HasLastUpdateElapsed(suppress time.Duration) bool

func (*State) IsUpdatable added in v1.3.0

func (s *State) IsUpdatable() bool

type StateHandler added in v1.3.0

type StateHandler interface {
	Init(location string) error
	Load() (State, error)
	Save(State) error
}

func NewFileStateHandler added in v1.3.0

func NewFileStateHandler(fs vfs.FS) StateHandler

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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