From 15ffe76847c4c0383c4d0c0a35fb29d5031d093b Mon Sep 17 00:00:00 2001 From: Rasmus Dahlberg Date: Sat, 18 Mar 2023 13:17:40 +0100 Subject: more light refactoring --- internal/utils/utils.go | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 internal/utils/utils.go (limited to 'internal/utils/utils.go') diff --git a/internal/utils/utils.go b/internal/utils/utils.go deleted file mode 100644 index 5b27868..0000000 --- a/internal/utils/utils.go +++ /dev/null @@ -1,47 +0,0 @@ -package utils - -import ( - "crypto/sha256" - "fmt" - "os" - - "gitlab.torproject.org/rgdd/ct/pkg/metadata" -) - -// Logs select logs that count towards CT-compliance checks. Logs that don't -// have a description are skipped after printing a warning. -func Logs(md metadata.Metadata) (logs []metadata.Log) { - for _, operators := range md.Operators { - for _, log := range operators.Logs { - if log.Description == nil { - fmt.Fprintf(os.Stderr, "WARNING: skipping log without description") - continue - } - if log.State == nil { - continue // skip logs with unknown states - } - if log.State.Name == metadata.LogStatePending { - continue // pending logs do not count towards CT-compliance - } - if log.State.Name == metadata.LogStateRetired { - continue // retired logs are not necessarily reachable - } - if log.State.Name == metadata.LogStateRejected { - continue // rejected logs do not count towards CT-compliance - } - - logs = append(logs, log) - } - } - return -} - -// Proof formats hashes so that they can be passed to the merkle package -func Proof(hashes [][]byte) (p [][sha256.Size]byte) { - for _, hash := range hashes { - var h [sha256.Size]byte - copy(h[:], hash) - p = append(p, h) - } - return -} -- cgit v1.2.3