debug

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 23 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

The debug report a person shares when asking for help: the setup summary of the install and the ends of its logs, shown to the person exactly as it will leave, uploaded to a paste service with every secret masked, and deleted again once its time is up. Where it goes is brought by the paste services registered

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

type Bundle struct {
	// What a share names the report by, kept for a while after it was made
	Token string
	Parts []Part
	Made  time.Time
	// Profile it is of
	Profile string
}

A debug report as it will leave this computer: the report itself first, then each log shared whole, every secret in them masked

type Debug

type Debug struct {
	Registry
	// contains filtered or unexported fields
}

The debug reports of this install: collecting one as it will leave, sharing it through the paste services, and the pastes kept to be deleted once their time is up

func New

func New(cfg *config.Config, su *status.Status) *Debug

func (*Debug) Collect

func (d *Debug) Collect(ctx context.Context, cfg *config.Config, lines int, alone bool) Bundle

Collects the debug report of the profile of the settings, kept by its token for the share that uploads it exactly as the person read it: when and of what it is, the setup summary, the end of each log a feature keeps, lines of each as the log or the lines given say, the settings' count for none; and, unless the report alone is asked for, each log a feature shares whole, as much of its end as the settings say. Every part has every secret in it masked, the profile's own wherever they stand

func (*Debug) Delete

func (d *Debug) Delete(ctx context.Context, cfg *config.Config, addresses []string) []Deleted

Deletes the pastes at the addresses, each on the service it is of, and forgets them among the pastes kept: what came of each, in the order given

func (*Debug) Fate

func (d *Debug) Fate(service Service) string

What becomes of a paste of the service once shared, in a sentence: deleted after the time set, or kept by the service for as long as it keeps them

func (*Debug) Notice

func (d *Debug) Notice() string

What a person is told before a report leaves this computer: where it goes, what it may hold that no masking takes out, who can read it, and what becomes of it on each service it may go to

func (*Debug) Ordered

func (d *Debug) Ordered() []Service

Paste services in the order they are tried: those debug.services names in its order, then the rest in the order they are registered

func (*Debug) Pending

func (d *Debug) Pending() []Link

Pastes shared that are kept to be deleted, the first due first

func (*Debug) Register

func (d *Debug) Register(registrant Registrant)

Adds a registrant; a registry nested in the host reaches it through Host

func (*Debug) Share

func (d *Debug) Share(ctx context.Context, cfg *config.Config, token string) (Shared, error)

Uploads the report collected under the token exactly as it was collected, each part to the first paste service that takes it, and keeps the pastes of the services that delete them to be deleted once the time the settings keep them passed. The report itself must go; a log shared whole that no service took is told among the failures

func (*Debug) Sweep

func (d *Debug) Sweep(ctx context.Context)

Deletes the pastes whose time is up, each on the service it is of: one deleted, or past its time by a day and still there, is forgotten, one that failed is tried again by the next sweep. Never fails the work that asked for it

func (*Debug) Tend

func (d *Debug) Tend(ctx context.Context) error

The work of the debug reports while icebath runs, which their service does until the context ends: the pastes whose time is up deleted every while, as on every call of the reports

type Deleted

type Deleted struct {
	Address string
	Done    bool
	Said    string
}

What came of deleting one paste

type Link struct {
	// Part of the report it holds, its address, and the service it is on
	Title, Address, Service string
	// When it is deleted, or when the service drops it where it can't be deleted; zero for a paste kept for good
	Until time.Time
	// The paste is deleted when its time is up, rather than dropped by the service
	Deletes bool
}

A paste a debug report was shared as

type Part

type Part struct {
	Title string
	Text  string
}

One text of a debug report, as it is uploaded

type Registrant

type Registrant interface {
	Services() []Service
}

type Registry

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

func (*Registry) Host

func (r *Registry) Host() *Debug

Host the registry is nested in, through which plugins reach the debug reports

func (*Registry) Register

func (r *Registry) Register(registrant Registrant)

func (*Registry) Services

func (r *Registry) Services() []Service

type Service

type Service struct {
	// Name debug.services orders it by, what a person calls it, and the site its pastes are on
	Name, Title, Site string
	// Most bytes one paste holds there, any for zero: a longer text goes to the next service
	Most int
	// How long the service keeps a paste asked to stay for the time given, nil for one that keeps it until it is deleted
	Expiry func(keep time.Duration) time.Duration
	// Uploads the text, asked to stay for the time given where the service takes that, and gives the address of the paste
	Upload func(ctx context.Context, client *http.Client, text string, keep time.Duration) (string, error)
	// Deletes the paste at the address; nil for a service whose pastes can't be deleted, which stay as long as it keeps them
	Delete func(ctx context.Context, client *http.Client, address string) error
	// Whether the address is of a paste of the service
	Owns func(address string) bool
}

A paste service a debug report is shared through, such as paste.rs

func (Service) Services

func (s Service) Services() []Service

A paste service is a registrant of itself, so a plugin registers the one it uploads to

type Shared

type Shared struct {
	Links    []Link
	Failures []string
}

What sharing a report came to: the pastes made, and the parts that could not be uploaded with why

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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