ctcloud: CertSpotter-backed CT cloud-resource monitor
Single stateless Go process that consumes CT logs via embedded (patched) CertSpotter internals, classifies cloud/database/storage DNS identifiers in-process with a zero-allocation classifier, enriches via round-robin DNS resolvers with CNAME following, and batch-writes useful findings to PostgreSQL. - third_party/certspotter: 2-hunk IdentifierSink patch, no stdout/JSON/files - internal/classify: AWS/Azure/GCP/Firebase/Cloudflare R2/DigitalOcean/Supabase/OCI - internal/dns: sharded bounded TTL cache, multi-resolver load balancing + failover - internal/pipeline: bounded queues, dedup, direct-priority load shedding - internal/store: pgx batch writer, Postgres CT checkpoints (no cert contents) - internal/probe: optional non-destructive reachability checks (off by default) - Docker: distroless non-root, read-only rootfs, no app volume, resource limits - tests enforce 0 allocs/op on the classifier and sink hot path
This commit is contained in:
1 parent
9e78a114ac
commit
e8f7d6bfdf
118 files changed
+16473
No files matched your search
+38
@@ -0,0 +1,38 @@
|
||||
// Copyright (C) 2025 Opsmate, Inc.
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla
|
||||
// Public License, v. 2.0. If a copy of the MPL was not distributed
|
||||
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
//
|
||||
// This software is distributed WITHOUT A WARRANTY OF ANY KIND.
|
||||
// See the Mozilla Public License for details.
|
||||
|
||||
package ctclient
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFormatTileIndex(t *testing.T) {
|
||||
tests := []struct {
|
||||
in uint64
|
||||
out string
|
||||
}{
|
||||
{0, "000"},
|
||||
{1, "001"},
|
||||
{12, "012"},
|
||||
{105, "105"},
|
||||
{1000, "x001/000"},
|
||||
{1050, "x001/050"},
|
||||
{52123, "x052/123"},
|
||||
{999001, "x999/001"},
|
||||
{1999001, "x001/x999/001"},
|
||||
{15999001, "x015/x999/001"},
|
||||
}
|
||||
for i, test := range tests {
|
||||
result := formatTileIndex(test.in)
|
||||
if result != test.out {
|
||||
t.Errorf("#%d: formatTileIndex(%q) = %q, want %q", i, test.in, result, test.out)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user