Documentation
¶
Overview ¶
Package servertracker provides an in-memory tracker for unique email servers seen by the SMTP endpoint. It uses salted hashing for privacy — server IPs and domains are never stored in cleartext. The salt is regenerated on each process restart, so the tracker resets naturally.
The tracker writes summary counts to a JSON status file in RuntimeDirectory, which can be read by the CLI.
It distinguishes between:
- Connection IPs: the remote IP of the connecting SMTP server
- Domain servers: senders like user@example.com (domain = example.com)
- IP servers: senders like user@[1.2.3.4] or user@1.2.3.4
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Status ¶
type Status struct {
BootTime int64 `json:"boot_time"`
UniqueConnIPs int `json:"unique_conn_ips"`
UniqueDomains int `json:"unique_domains"`
UniqueIPServers int `json:"unique_ip_servers"`
}
Status is the JSON structure written to the status file.
func ReadStatusFile ¶
ReadStatusFile reads the tracker status from the status file on disk. This is used by the CLI to read counts from the running server.
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker holds salted hashes of unique server identifiers.
func Global ¶
func Global() *Tracker
Global returns the singleton tracker. It is created on first call with a fresh random salt. Boot time is recorded at creation.
func (*Tracker) RecordServer ¶
RecordServer records a connecting server IP and the sender's domain/IP. The connIP is the TCP connection's remote IP. The senderDomain is the domain part of the MAIL FROM address. Both are stored as salted hashes. Empty values are ignored.