From 1ab895e6172f6c196836fb37b853cc66cccd81e2 Mon Sep 17 00:00:00 2001 From: Jie Date: Thu, 21 Apr 2022 14:43:27 -0400 Subject: [PATCH] Updated Readme for Monitor --- CTng/monitor/Readme.md | 24 ++++++++++++++++++++++++ CTng/monitor/types.go | 36 +++--------------------------------- CTng/server/Readme.md | 10 ---------- 3 files changed, 27 insertions(+), 43 deletions(-) create mode 100644 CTng/monitor/Readme.md delete mode 100644 CTng/server/Readme.md diff --git a/CTng/monitor/Readme.md b/CTng/monitor/Readme.md new file mode 100644 index 0000000..e07afe2 --- /dev/null +++ b/CTng/monitor/Readme.md @@ -0,0 +1,24 @@ +# Monitor Implementation + +## Contents +- `types.go`: type declarations for monitor context and some basic monitor methods definitions +- `monitor.go`: implementation of some monitor functions that will be used by monitor_server in the server folder +- `monitor_process.go`: contains only the process valid gossip object function + +## types.go +-`Monitor_context`: monitor context is a object that contains all the configuration and storage information about the monitor +- `methods`: internal methods defined in this file includes savestorage, loadstorage, getobject, isduplicate, and store object +## monitor.go +- `Queryloggers`: HTTP get request send to loggers +- `QueryAuthorities`: HTTP get request send to CAs +- `Check_entity_pom`: check if there is a pom against the provided URL +- `Islogger`: check if the entities is in the Loggers list from the public config file +- `IsAuthority`: check if the entities is in the CAs list from the public config file +- `AccuseEntity`: accuses the entity if its URL is provided +- `Send_to_gossiper`: send the input gossip object to the gossiper + +## monitor_process.go +- `process_valid_object`: + if the logger sends the sth to the monitor,this function will send the raw version to the gossiper, wait for gossip_wait_time, check its updated PoM database, + if the signer of this sth/revocation information is not in it, threshold sign this sth and send it to the gossiper + Same thing applies to revocation information and CA it will store all the valid gossip object from its own gossiper, including different types of PoMs and fully signed sths and revocation information diff --git a/CTng/monitor/types.go b/CTng/monitor/types.go index 3bb9b27..19b0395 100644 --- a/CTng/monitor/types.go +++ b/CTng/monitor/types.go @@ -6,48 +6,18 @@ import ( "CTng/util" "encoding/json" "net/http" - "sync" - "time" ) type MonitorContext struct { - Config *config.Monitor_config - Storage *gossip.Gossip_Storage - StorageFile string - Timer_CAs TimedMap - Timer_Loggers TimedMap - Timer_Loggers_LastCheckIn int64 - Timer_CAs_LastCheckIn int64 + Config *config.Monitor_config + Storage *gossip.Gossip_Storage + StorageFile string // TODO: Utilize Storage directory: A folder for the files of each MMD. // Folder should be set to the current MMD "Period" String upon initialization. StorageDirectory string Client *http.Client } -type TimedMap struct { - m map[string]int64 - mu *sync.Mutex -} - -func (c *MonitorContext) InitializeTimedMap() { - var tm1 TimedMap - var tm2 TimedMap - var m1 map[string]int64 - var m2 map[string]int64 - tm1.m = m1 - tm2.m = m2 - for _, v := range c.Config.Logger_URLs { - tm1.m[v] = time.Now().Unix() - } - for _, v := range c.Config.CA_URLs { - tm1.m[v] = time.Now().Unix() - } - c.Timer_Loggers = tm1 - c.Timer_CAs = tm2 - c.Timer_Loggers_LastCheckIn = time.Now().Unix() - c.Timer_CAs_LastCheckIn = time.Now().Unix() -} - func (c *MonitorContext) SaveStorage() error { storageList := []gossip.Gossip_object{} for _, gossipObject := range *c.Storage { diff --git a/CTng/server/Readme.md b/CTng/server/Readme.md deleted file mode 100644 index d0cd7f6..0000000 --- a/CTng/server/Readme.md +++ /dev/null @@ -1,10 +0,0 @@ -# Monitor_ng.go - -##### Monitor_accuseEntity: this function accuses the entity if its URL is provided -##### Monitor_send_to_gossiper: this function send the input gossip object to the gossiper -##### Monitor_process_valid_object: -###### if the logger sends the sth to the monitor,this function will send the raw version to the gossiper, wait for gossip_wait_time, check its updated PoM database, -###### if the signer of this sth/revocation information is not in it, threshold sign this sth and send it to the gossiper -###### Same thing applies to revocation information and CA it will store all the valid gossip object from its own gossiper, including different types of PoMs and fully signed sths and revocation information - -###### func Monitor_handle_gossip: Handles gossip object it received through HTTP