# famasoon/crtsh architecture

> Architecture diagram of the GitHub repository famasoon/crtsh, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/famasoon/crtsh
- Repository: https://github.com/famasoon/crtsh

## Overview

crtsh is a Go CLI and importable package for querying crt.sh certificate-transparency records and extracting DNS names from a certificate. The main workflow dispatches domain or Common Name searches to crt.sh and prints full records or names only; a separate certificate-ID workflow downloads PEM data, parses the certificate, and prints its DNS names. The source shows these calls and output paths; no persistent storage is present.

Main entry points: [`main.go`](https://github.com/famasoon/crtsh/blob/master/main.go) (Argument dispatch), [`crtlog/ctlog.go`](https://github.com/famasoon/crtsh/blob/master/crtlog/ctlog.go) (Search and display), [`parser/parser.go`](https://github.com/famasoon/crtsh/blob/master/parser/parser.go) (PEM and DNS parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI"]
  node_main["Argument dispatch<br/>[main.go]"]
end

subgraph group_search["CT Search"]
  node_search_api["Search and display<br/>[ctlog.go]"]
  node_http_fetch["HTTP retrieval<br/>[ctlog.go]"]
end

subgraph group_cert["Certificate Parsing"]
  node_parser["PEM and DNS parsing<br/>[parser.go]"]
end

node_user(("CLI user"))
node_crtsh["crt.sh"]
node_stdout["Terminal output"]

node_user -->|"provides options"| node_main
node_main -->|"dispatches search"| node_search_api
node_main -->|"dispatches certificate ID"| node_parser
node_search_api -->|"requests records"| node_http_fetch
node_parser -->|"requests PEM"| node_http_fetch
node_http_fetch -->|"fetches data"| node_crtsh
node_search_api -->|"prints records or names"| node_stdout
node_parser -->|"prints DNS names"| node_stdout

click node_main "https://github.com/famasoon/crtsh/blob/master/main.go"
click node_search_api "https://github.com/famasoon/crtsh/blob/master/crtlog/ctlog.go"
click node_http_fetch "https://github.com/famasoon/crtsh/blob/master/crtlog/ctlog.go"
click node_parser "https://github.com/famasoon/crtsh/blob/master/parser/parser.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_user toneBlue
class node_search_api,node_http_fetch toneAmber
class node_parser toneMint
class node_crtsh,node_stdout toneIndigo
```

## Components

### CLI

- [Argument dispatch](https://github.com/famasoon/crtsh/blob/master/main.go): `main.go`

### CT Search

- [Search and display](https://github.com/famasoon/crtsh/blob/master/crtlog/ctlog.go): `crtlog/ctlog.go`
- [HTTP retrieval](https://github.com/famasoon/crtsh/blob/master/crtlog/ctlog.go): `crtlog/ctlog.go`

### Certificate Parsing

- [PEM and DNS parsing](https://github.com/famasoon/crtsh/blob/master/parser/parser.go): `parser/parser.go`

### Other components

- **CLI user**
- **crt.sh**
- **Terminal output**

## Connections

- CLI user → Argument dispatch: provides options
- Argument dispatch → Search and display: dispatches search
- Argument dispatch → PEM and DNS parsing: dispatches certificate ID
- Search and display → HTTP retrieval: requests records
- PEM and DNS parsing → HTTP retrieval: requests PEM
- HTTP retrieval → crt.sh: fetches data
- Search and display → Terminal output: prints records or names
- PEM and DNS parsing → Terminal output: prints DNS names
