Documentation
¶
Overview ¶
Package skeleton reduces an API answer to its structure: the HTTP status, the key paths with their JSON types, and each error text with only the grammar's own words kept. It is how `make probe-acl` (and later `make live`) records what the real API sends without recording a single value from the tailnet.
Redaction here is an allowlist, never a detector. Nothing is looked for and removed: a token survives only if it is on the short list of words below, a key survives only if it is on the list of keys the API documents, and everything else is replaced by a fixed placeholder (<s> for a word, <n> for a number, <key> for a key). A value the author never thought of therefore cannot leak, which a pattern for IP addresses or key prefixes cannot promise.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ETagForm ¶
ETagForm describes an ETag header without showing it: none, weak or strong, quoted or not, and whether the inside is 64 lower-case hex digits (a SHA-256), hex of another length, the documented placeholder ts-default, or anything else.
func Template ¶
Template reduces s to its template. Every token (a run of characters that are neither white space nor in separators) becomes <n> when it is only ASCII digits, stays when it is one of words, and becomes <s> otherwise; the phrases above stay as they are; the separators stay; a run of white space becomes one space; nothing else is written. The output therefore holds nothing but those pieces.
Types ¶
type Options ¶
type Options struct {
// Keys are the object keys that appear in a path; any other key appears as <key>.
Keys map[string]bool
// TextPaths are the paths whose strings are listed as templates. A string at any other
// path is recorded as a type only.
TextPaths map[string]bool
// TemplateText also lists a template of a body that is not JSON, when its status is 400
// or above: a refusal's text is the server's wording. A text body that came with a lower
// status is the tailnet's own document (the policy as HuJSON), so it is recorded as a
// type only, whatever this says.
TemplateText bool
}
Options say which keys and strings an answer's skeleton may show.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions are the keys the Tailscale API documents for the answers of the validate endpoint, the policy endpoint (details=true) and the configuration audit log, and the paths of the message-bearing strings among them.
type Path ¶
Path is a key path and the JSON type found there. The root is "$"; below it an object member is its key (a.b), and an array element is "[]" (a[].b).
type Skeleton ¶
type Skeleton struct {
Status int `json:"status"`
Body string `json:"body"` // empty, json or text
Paths []Path `json:"paths,omitempty"` // json bodies only
Texts []string `json:"texts,omitempty"` // templates of the strings at Options.TextPaths, sorted, each once
Truncated bool `json:"truncated,omitempty"` // more paths or texts than the caps below, or nesting deeper than maxDepth
}
Skeleton is what is recorded of one answer.