fixtures

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fixtures pseudonymises captured Beszel hub responses so they can be committed as test data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind string

Kind names the hub response a file holds and selects its rules.

const (
	KindInfo           Kind = "info"
	KindSystems        Kind = "systems"
	KindSystemDetails  Kind = "system_details"
	KindSystemStats    Kind = "system_stats"
	KindContainerStats Kind = "container_stats"
	KindContainers     Kind = "containers"
	KindServices       Kind = "systemd_services"
	KindSmart          Kind = "smart_devices"
	KindMonitors       Kind = "network_monitors"
	KindMonitorStats   Kind = "network_monitor_stats"
	KindPackageUpdates Kind = "package_updates"
)

Response kinds the sanitiser knows.

type Sanitiser

type Sanitiser struct {
	// contains filtered or unexported fields
}

Sanitiser maps each original value to one pseudonym across all files, so references between records survive.

func New

func New(capturedAt time.Time) *Sanitiser

New returns an empty Sanitiser for a capture taken at capturedAt.

func (*Sanitiser) File

func (s *Sanitiser) File(kind Kind, data []byte) ([]byte, error)

File sanitises one captured response. Files that name systems must come after the systems file, so hostnames can follow their system's pseudonym.

func (*Sanitiser) Leaks

func (s *Sanitiser) Leaks(files map[string][]byte, denyWords []string) []string

Leaks reports every replaced original, deny word (case-insensitive) or private-looking value still present in files (name -> content). Originals shorter than 4 chars are skipped, and kept values are masked first, so "postgres:18" inside a kept "postgres:18-alpine" is not a leak.

func (*Sanitiser) SystemName

func (s *Sanitiser) SystemName(id string) string

SystemName returns the pseudonym given to the system with the original id, or "" if the systems file has not been sanitised yet.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL