Skip to content

Commit

Permalink
Updated Readme for Monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
jik18001 committed Apr 21, 2022
1 parent f41e6cc commit 1ab895e
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 43 deletions.
24 changes: 24 additions & 0 deletions CTng/monitor/Readme.md
Original file line number Diff line number Diff line change
@@ -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
36 changes: 3 additions & 33 deletions CTng/monitor/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 0 additions & 10 deletions CTng/server/Readme.md

This file was deleted.

0 comments on commit 1ab895e

Please sign in to comment.