cache

package
v0.0.0-...-9b07614 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: MulanPSL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

cache package saves information of client status to enhance performance.

Index

Constants

View Source
const (

	// StrUnknown means the string of unknown.
	StrUnknown = "unknown"
	// StrTrusted means the string of trusted.
	StrTrusted = "trusted"
	// StrUntrusted means the string of untrusted.
	StrUntrusted = "untrusted"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache struct {

	// for verify process
	Bases   []*typdefs.BaseRow
	TaBases map[string]*typdefs.TaBaseRow
	// contains filtered or unexported fields
}

Cache stores the latest status of one RAC client and commands.

func NewCache

func NewCache() *Cache

NewCache creates a new cache to save client information.

func (*Cache) ClearBases

func (c *Cache) ClearBases()

ClearBases clears the bases.

func (*Cache) ClearCommands

func (c *Cache) ClearCommands()

ClearCommands clears the client commands.

func (*Cache) CompareNonce

func (c *Cache) CompareNonce(n uint64) bool

CompareNonce checks the returned nonce match or not.

func (*Cache) GetBases

func (c *Cache) GetBases() []*typdefs.BaseRow

GetBases returns the baases.

func (*Cache) GetCommands

func (c *Cache) GetCommands() uint64

GetCommands gets the pending commands of client.

func (*Cache) GetIKeyCert

func (c *Cache) GetIKeyCert() *x509.Certificate

GetIKeyCert returns the client IK certificate for validate the trust report.

func (*Cache) GetIsAutoUpdate

func (c *Cache) GetIsAutoUpdate() bool

GetIsAutoUpdate returns the client autoupdate strategy.

func (*Cache) GetNonce

func (c *Cache) GetNonce() uint64

GetNonce returns a nonce value for remote attestation trust report.

func (*Cache) GetOnline

func (c *Cache) GetOnline() bool

GetOnline returns the client online expiration time.

func (*Cache) GetRegTime

func (c *Cache) GetRegTime() string

GetRegTime returns the client register time.

func (*Cache) GetTaTrusted

func (c *Cache) GetTaTrusted(uuid string) string

GetTaTrusted checks weather the TA trust report is valid or not.

func (*Cache) GetTrustExpiration

func (c *Cache) GetTrustExpiration() time.Time

func (*Cache) GetTrusted

func (c *Cache) GetTrusted() string

GetTrusted checks weather the RAC trust report is valid or not.

func (*Cache) HasCommands

func (c *Cache) HasCommands() bool

HasCommands checks if the client has some commands.

func (*Cache) IsHeartBeatExpired

func (c *Cache) IsHeartBeatExpired() bool

IsHeartBeatExpired checks if the client is expired.

func (*Cache) SetBases

func (c *Cache) SetBases(baserow *typdefs.BaseRow)

SetBases saves the bases.

func (*Cache) SetCommands

func (c *Cache) SetCommands(cmds uint64)

SetCommands saves the new commands for waiting.

func (*Cache) SetIKeyCert

func (c *Cache) SetIKeyCert(pemCert string)

SetIKeyCert saves the client IK certificate in cache to enhance performance.

func (*Cache) SetIsAutoUpdate

func (c *Cache) SetIsAutoUpdate(v bool)

SetIsAutoUpdate saves the client autoppdate strategy.

func (*Cache) SetRegTime

func (c *Cache) SetRegTime(v string)

SetRegTime saves the client register time.

func (*Cache) SetTaTrusted

func (c *Cache) SetTaTrusted(uuid string, v string)

SetTaTrusted sets the ta trusted field by uuid.

func (*Cache) SetTrusted

func (c *Cache) SetTrusted(v string)

SetTrusted sets the host trusted field.

func (*Cache) UpdateHeartBeat

func (c *Cache) UpdateHeartBeat(hb time.Duration)

UpdateHeartBeat is called when receives heart beat message from RAC.

func (*Cache) UpdateOnline

func (c *Cache) UpdateOnline(t time.Duration)

UpdateOnline updates online expiration.

func (*Cache) UpdateTrustReport

func (c *Cache) UpdateTrustReport(trust time.Duration)

UpdateTrustReport is called when receives trust report message from RAC.

Jump to

Keyboard shortcuts

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