Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NowRFC3339 ¶
func NowRFC3339() string
NowRFC3339 returns the current UTC time formatted as RFC3339. All wire payloads (telemetry and command responses) use this format in their "ts" field, matching the other stone-age.io applications.
func Round ¶
Round rounds a float64 value to 2 decimal places Used throughout the agent for metrics to avoid unnecessary precision
func WriteFileAtomic ¶ added in v0.5.0
WriteFileAtomic writes data through a temp file in the same directory and renames it into place, so a crash mid-write cannot leave a truncated file.
What that protects is different for each caller, and every one of them matters: an agent that cannot parse its own .creds, platform session or Nebula cache does not come back on its own, and a nats-server handed a half-written nats-leaf.conf on reload or restart refuses it. The rename is what makes a reader see either the old file or the new one, never a mixture.
perm is applied to the temp file before anything is written to it, so the secrets (0600) are never readable by anyone else even for an instant. It is set with Chmod rather than at create time, so the umask does not get a vote: a 0644 config is 0644 on every box. os.CreateTemp alone opens 0600, which is what every caller wanted before the leaf config needed to be world-readable.
It used to be two identical unexported copies, in platform and in nebula, and both were 0600-only.
Types ¶
This section is empty.