diff --git a/CTng/GZip/Decode.go b/CTng/GZip/Decode.go index 00c138b..2f66a3e 100644 --- a/CTng/GZip/Decode.go +++ b/CTng/GZip/Decode.go @@ -1,4 +1,4 @@ -package GZIP64 +package GZip //go-gzipb64 Github Repo diff --git a/CTng/GZip/GZipDecomp.go b/CTng/GZip/GZipDecomp.go index 79c3774..c1996d4 100644 --- a/CTng/GZip/GZipDecomp.go +++ b/CTng/GZip/GZipDecomp.go @@ -1,4 +1,4 @@ -package GZIP64 +package GZip import ( "bytes" diff --git a/CTng/GZip/GZipbyte.go b/CTng/GZip/GZipbyte.go index f692b70..a196c66 100644 --- a/CTng/GZip/GZipbyte.go +++ b/CTng/GZip/GZipbyte.go @@ -5,7 +5,7 @@ import ( "compress/gzip" ) -func compress(input []byte) []byte { +func Compress(input []byte) []byte { var buf bytes.Buffer compr := gzip.NewWriter(&buf) compr.Write(input) diff --git a/CTng/testData/fakeCA/fakeCA.go b/CTng/testData/fakeCA/fakeCA.go index b140c48..eb2ded8 100644 --- a/CTng/testData/fakeCA/fakeCA.go +++ b/CTng/testData/fakeCA/fakeCA.go @@ -1,6 +1,7 @@ package fakeCA import ( + "CTng/GZip" "CTng/crypto" "CTng/gossip" "CTng/util" @@ -45,7 +46,7 @@ func generateCRVs(CA CAConfig) gossip.Gossip_object { delta_crv[i] = e & sec_arr[i] } //this is scuffed/slow for giant CRVs O(n), also I am assuming CRVs are same size, can modify for different sizes - delta_crv = GZip.compress(delta_crv) //should work... + delta_crv = GZip.Compress(delta_crv) //should work... REV := Revocation{ SRH: CA.Signer, @@ -67,6 +68,8 @@ func generateCRVs(CA CAConfig) gossip.Gossip_object { } func periodicTasks() { + // Queue the next tasks to occur at next MRD. + time.AfterFunc(time.Duration(config.MRD)*time.Second, periodicTasks) // Generate CRV and SRH fmt.Println("Running Tasks") Rev1 := generateCRVs(config) @@ -75,8 +78,6 @@ func periodicTasks() { SRHs = append(SRHs, Rev1) fakeSRHs = append(fakeSRHs, fakeRev1) currentPeriod++ - // Queue the next tasks to occur at next MRD. - time.AfterFunc(time.Duration(config.MRD)*time.Second, periodicTasks) } //I'm up to here right now, messaged on discord just to make sure I'm on a good path @@ -104,10 +105,10 @@ func RunCA(configFile string) { currentPeriod = 0 request_count = 0 - STHS = make([]gossip.Gossip_object, 0, 20) - fakeSTHs = make([]gossip.Gossip_object, 0, 20) + SRHs = make([]gossip.Gossip_object, 0, 20) + fakeSRHs = make([]gossip.Gossip_object, 0, 20) // Read the config file - config = LoggerConfig{} + config = CAConfig{} configBytes, err := util.ReadByte(configFile) if err != nil { fmt.Println("Error reading config file: ", err) @@ -120,7 +121,7 @@ func RunCA(configFile string) { getLoggerType() // MUX which routes HTTP directories to functions. gorillaRouter := mux.NewRouter().StrictSlash(true) - gorillaRouter.HandleFunc("/ctng/v2/get-sth", requestSTH).Methods("GET") + gorillaRouter.HandleFunc("/ctng/v2/get-revocation", requestSTH).Methods("GET") http.Handle("/", gorillaRouter) fmt.Println("Listening on port", config.Port) go periodicTasks() diff --git a/CTng/testData/fakeLogger/fakeLogger.go b/CTng/testData/fakeLogger/fakeLogger.go index 4f56852..6176caa 100644 --- a/CTng/testData/fakeLogger/fakeLogger.go +++ b/CTng/testData/fakeLogger/fakeLogger.go @@ -59,6 +59,8 @@ func generateSTH(loggerType int) gossip.Gossip_object { } func periodicTasks() { + // Queue the next tasks to occur at next MMD. + time.AfterFunc(time.Duration(config.MMD)*time.Second, periodicTasks) // Generate STH and FakeSTH fmt.Println("Running Tasks") sth1 := generateSTH(loggerType) @@ -67,8 +69,6 @@ func periodicTasks() { STHS = append(STHS, sth1) fakeSTHs = append(fakeSTHs, fakeSTH1) currentPeriod++ - // Queue the next tasks to occur at next MMD. - time.AfterFunc(time.Duration(config.MMD)*time.Second, periodicTasks) } func requestSTH(w http.ResponseWriter, r *http.Request) { diff --git a/CTng/testData/fakeLogger/logger1.json b/CTng/testData/fakeLogger/logger1.json index 127d990..29496bc 100644 --- a/CTng/testData/fakeLogger/logger1.json +++ b/CTng/testData/fakeLogger/logger1.json @@ -21,5 +21,5 @@ "E": 65537 }, "MMD": 10, - "MisbehaviorInterval": 3 + "MisbehaviorInterval": 1 } \ No newline at end of file