monitor

package
v0.0.0-...-1e6caf6 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const PROTOCOL = "http://"

Variables

This section is empty.

Functions

func AccuseEntity

func AccuseEntity(c *MonitorContext, Accused string)

This function accuses the entity if the domain name is provided It is called when the gossip object received is not valid, or the monitor didn't get response when querying the logger or the CA Accused = Domain name of the accused entity (logger etc.)

func Check_entity_pom

func Check_entity_pom(c *MonitorContext, Accused string) bool

this function takes the name of the entity as input and check if there is a POM against it this should be invoked after the monitor receives the information from its loggers and CAs prior to threshold signning it

func Get_SRH_and_DCRV

func Get_SRH_and_DCRV(rev definition.Gossip_object) (string, bitset.BitSet)

func IsAuthority

func IsAuthority(c *MonitorContext, authURL string) bool

func IsLogger

func IsLogger(c *MonitorContext, loggerURL string) bool

func PeriodicTasks

func PeriodicTasks(c *MonitorContext)

func Process_valid_object

func Process_valid_object(c *MonitorContext, g definition.Gossip_object)

This function is called by handle_gossip in monitor_server.go under the server folder It will be called if the gossip object is validated

func QueryAuthorities

func QueryAuthorities(c *MonitorContext)

func QueryLoggers

func QueryLoggers(c *MonitorContext)

func Send_to_gossiper

func Send_to_gossiper(c *MonitorContext, g definition.Gossip_object)

Send the input gossip object to its gossiper

func StartMonitorServer

func StartMonitorServer(c *MonitorContext)

func Wait_then_accuse

func Wait_then_accuse(c *MonitorContext, Accused string, Entity_type string)

Types

type ClientUpdate

type ClientUpdate struct {
	STHs      []definition.Gossip_object
	REVs      []definition.Gossip_object
	POM_CONs  []definition.Gossip_object
	POM_ACCs  []definition.Gossip_object
	MonitorID string
	//Period here means the update period, the client udpate object can contain more information than just the period
	Period string
}

func GenerateUpdate

func GenerateUpdate(c *MonitorContext) ClientUpdate

func PrepareClientUpdate

func PrepareClientUpdate(context *MonitorContext, filepath string) (*ClientUpdate, error)

type MonitorContext

type MonitorContext struct {
	Monitor_private_config *Monitor_private_config
	Monitor_public_config  *Monitor_public_config
	Monitor_crypto_config  *crypto.CryptoConfig
	Storage_TEMP           *definition.Gossip_Storage
	// Gossip objects from the gossiper will be assigned to their dedicated storage
	// we need to keep track of all poms but we only need delta pom for each update period
	Storage_CONFLICT_POM         *definition.Gossip_Storage
	Storage_ACCUSATION_POM       *definition.Gossip_Storage
	Storage_CONFLICT_POM_DELTA   *definition.Gossip_Storage
	Storage_ACCUSATION_POM_DELTA *definition.Gossip_Storage
	Storage_STH_FULL             *definition.Gossip_Storage
	Storage_REV_FULL             *definition.Gossip_Storage
	Storage_CRV                  map[string]*bitset.BitSet
	// Utilize Storage directory: A folder for the files of each MMD.
	// Folder should be set to the current MMD "Period" String upon initialization.
	StorageFile_CRV  string
	StorageDirectory string
	StorageID        string
	// The below could be used to prevent a Monitor from sending duplicate Accusations,
	// Currently, if a monitor accuses two entities in the same Period, it will trigger a gossip PoM.
	// Therefore, a monitor can only accuse once per Period. I believe this is a temporary solution.
	Verbose bool
	Client  *http.Client
	//for testing purposes only
	Mode                   int
	Period_Offset          string
	Clockdrift_miliseconds int
	Maxdrift_miliseconds   int
	Max_latency            int
	Min_latency            int
	CRV_lock               *sync.Mutex
	CONFLICT_POM_lock      *sync.RWMutex
	ACCUSATION_POM_lock    *sync.RWMutex
	STH_FULL_lock          *sync.RWMutex
	REV_FULL_lock          *sync.RWMutex
	TEMP_lock              *sync.RWMutex
}

func InitializeMonitorContext

func InitializeMonitorContext(public_config_path string, private_config_path string, crypto_config_path string, storageID string) *MonitorContext

func (*MonitorContext) CleanUpMonitorStorage

func (c *MonitorContext) CleanUpMonitorStorage()

func (*MonitorContext) Clean_Conflicting_Object

func (c *MonitorContext) Clean_Conflicting_Object()

func (*MonitorContext) GetObject

func (*MonitorContext) GetObjectNumber

func (c *MonitorContext) GetObjectNumber(objtype string) int

func (*MonitorContext) InitializeMonitorStorage

func (c *MonitorContext) InitializeMonitorStorage(filepath string)

func (*MonitorContext) IsDuplicate

func (c *MonitorContext) IsDuplicate(g definition.Gossip_object) bool

func (*MonitorContext) LoadOneStorage

func (c *MonitorContext) LoadOneStorage(name string, filepath string) error

func (*MonitorContext) SaveStorage

func (c *MonitorContext) SaveStorage(Period string, update ClientUpdate) error

func (*MonitorContext) StoreObject

func (c *MonitorContext) StoreObject(o definition.Gossip_object)

func (*MonitorContext) VerifySRH

func (ctx *MonitorContext) VerifySRH(srh string, dCRV *bitset.BitSet, CAID string, Period string) bool

func (*MonitorContext) WipeStorage

func (c *MonitorContext) WipeStorage()

wipe all temp data

type Monitor_private_config

type Monitor_private_config struct {
	CA_URLs               []string
	Logger_URLs           []string
	Signer                string
	Gossiper_URL          string
	Inbound_gossiper_port string
	Port                  string
}

type Monitor_public_config

type Monitor_public_config struct {
	All_CA_URLs      []string
	All_Logger_URLs  []string
	Gossip_wait_time int
	MMD              int
	MRD              int
}

Jump to

Keyboard shortcuts

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