diff --git a/CTng/.gitignore b/CTng/.gitignore index 3b0b854..cad05f6 100644 --- a/CTng/.gitignore +++ b/CTng/.gitignore @@ -1,5 +1,5 @@ *.code-workspace -# Cryptography details shouldn't be stored on the repo IMO. -**/*/*.crypto.json +# Test generated Cryptography details shouldn't be stored on the repo IMO. +**/*/*.test.json __debug_bin \ No newline at end of file diff --git a/CTng/Readme.md b/CTng/Readme.md index 9d2619f..beab13a 100644 --- a/CTng/Readme.md +++ b/CTng/Readme.md @@ -1,16 +1,47 @@ +# Next Generation Certificate Transparency: -## Running the code +## Folders: + +**`config`**: Contains the layout of private and public json configuration files used by Monitors and Gossipers. Also contains loaders for the object versions of these .json files. + +**`crypto`**: Abstractions associated with CTng cryptographic implementations, and the cryptoconfig implementation. + +**`gossip`**: Defines the Gossip object, the state object of the Gossiper, and many functions associated with running a gossiper. + +**`GZip`**: Implements functions for reading arrays of bytes to a base-64 encoded, Gzip-compressed representation. + +**`monitor`**: Defines the monitor server state and functions associated with monitor tasks, such as querying Loggers and CAs. + +**`server`**: HTTP Server implementations for the Gossiper and Monitor. Should call functions from **`gossip`** or **`monitor`**, respectively. + +**`util`**: a package that has no internal imports: helper functions and constants that are used throughout the codebase but prevents import cycles from occurring (import cycles are not allowed in go). + + +**`testData`**: Defines a configuration of CTng with 4 monitors, 4 gossipers, 3 CAs, and 3 Loggers. Also defines a fakeLogger and fakeCA HTTP client for testing. ___ +## Files + +**`ctng.go`**: A commandline interface for running a Monitor, Gossiper, fakeLogger, or fakeCA. + +**`monitorTest.sh`**: run as `sh monitorTest.sh [N]`, where N is which monitor you want to run + +# Running the code + Run `go install .` before continuing! To run a single Monitor or gossiper, run -`go run . [gossiper|monitor|] [public_config_path] [private_config_path] [crypto_config_path]` + +`go run . [gossiper|monitor|logger] [public_config_path] [private_config_path] [crypto_config_path]`. + +E.X: `go run . gossiper ./public.json private.json crypto.json` + +To run a fakeLogger or fakeCA, run +`go run . [logger|ca] [configPath]` The `testData` folder contains configurations for testing, but configs can be generated using the functions in `config`. -## Function Documentation -___ +# Function Documentation Documentation + Function descriptions exist in each file/subfolder. -To view this this info + documentation in a formal documentation setting, utilize GoDoc. \ No newline at end of file +To view this this info + documentation in a formal documentation setting, GoDoc could be utilized, but requires installing the repository locally as a package. \ No newline at end of file diff --git a/CTng/config/config_test.go b/CTng/config/config_test.go index 1af94a7..6145ad4 100644 --- a/CTng/config/config_test.go +++ b/CTng/config/config_test.go @@ -57,7 +57,7 @@ func TestLoadConfigs(t *testing.T) { if err != nil { t.Error(err) } - gossiper_config, err := LoadGossiperConfig("test/gossiper_pub_config.json", "test/gossiper_priv_config.json", "test/localhost:8081.crypto.json") + gossiper_config, err := LoadGossiperConfig("test/gossiper_pub_config.json", "test/gossiper_priv_config.json", "test/localhost:8081.test.json") if err != nil { t.Error(err) } diff --git a/CTng/config/test/gossiper_priv_config.json b/CTng/config/test/gossiper_priv_config.json index 7cdd897..fad17af 100644 --- a/CTng/config/test/gossiper_priv_config.json +++ b/CTng/config/test/gossiper_priv_config.json @@ -1,5 +1,4 @@ { - "Crypto_config_path": "config/test/localhost:8080.crypto.json", "Connected_Gossipers": ["localhost:8082", "localhost:8083"], "Owner_URL": "localhost:8080", "Port": "8081" diff --git a/CTng/config/test/monitor_priv_config.json b/CTng/config/test/monitor_priv_config.json index 5cf2cb8..ea0c419 100644 --- a/CTng/config/test/monitor_priv_config.json +++ b/CTng/config/test/monitor_priv_config.json @@ -1,5 +1,4 @@ { - "Crypto_config_path": "config/test/localhost:8080.crypto.json", "CA_URLs": ["192.168.1.1", "1.1.1.1", "255.255.255.255"], "Logger_URLs": ["192.168.1.1", "1.1.1.1", "255.255.255.255"], "Gossiper_URL": "localhost:8081", diff --git a/CTng/crypto/crypto_test.go b/CTng/crypto/crypto_test.go index 223ddfd..b06c53a 100644 --- a/CTng/crypto/crypto_test.go +++ b/CTng/crypto/crypto_test.go @@ -185,7 +185,7 @@ func TestCryptoIO(T *testing.T) { readConfigs := make([]*CryptoConfig, len(configs)) // Load the crypto files for each entity, sign a message, and verify the joint signature is valid. for i := 0; i < len(entities); i++ { - c, err := ReadCryptoConfig("./testFiles/" + (string)(entities[i]) + ".crypto.json") + c, err := ReadCryptoConfig("./testFiles/" + (string)(entities[i]) + ".test.json") confirmNil(T, err) readConfigs[i] = c } diff --git a/CTng/crypto/generate_crypto.go b/CTng/crypto/generate_crypto.go index dad6eb4..7eeedf2 100644 --- a/CTng/crypto/generate_crypto.go +++ b/CTng/crypto/generate_crypto.go @@ -65,7 +65,7 @@ func GenerateEntityCryptoConfigs(entityIDs []CTngID, threshold int) ([]CryptoCon func SaveCryptoFiles(directory string, configs []CryptoConfig) error { for _, config := range configs { // fmt.Print(config) - file := fmt.Sprintf("%s/%s.crypto.json", directory, config.SelfID) + file := fmt.Sprintf("%s/%s.test.json", directory, config.SelfID) err := util.WriteData(file, *NewStoredCryptoConfig(&config)) if err != nil { return err