Documentation
¶
Index ¶
- Constants
- Variables
- type AllMetrics
- type Arg
- type CPUResult
- type ComposeService
- type DirEntry
- type FileStat
- type Job
- type JobEvent
- type JobResult
- type JobStatus
- type JournalEntry
- type ListenPort
- type LogLine
- type MemoryResult
- type Peer
- type PortEvent
- type ProcessStat
- type SendDirRequest
- type SendRequest
- type SendResult
- type TailkitPeer
- type Tool
Constants ¶
const ( // PatternIdentifier matches container names, service names, etc. PatternIdentifier = `^[a-zA-Z0-9_-]+$` // PatternPath matches absolute unix paths. PatternPath = `^(/[a-zA-Z0-9_./-]+)+$` // PatternSemver matches semantic version strings. PatternSemver = `^v?[0-9]+\.[0-9]+\.[0-9]+$` // PatternIP matches IPv4 addresses. PatternIP = `^(\d{1,3}\.){3}\d{1,3}$` // PatternPort matches valid port numbers. PatternPort = `^([1-9][0-9]{0,4})$` // PatternFilename matches safe filenames. PatternFilename = `^[a-zA-Z0-9_.,-]+$` )
Variables ¶
var ( ErrReceiveNotConfigured = errors.New("tailkit: node has no files.toml (receive not configured)") ErrToolNotFound = errors.New("tailkit: tool not installed on node") ErrCommandNotFound = errors.New("tailkit: command not registered by tool") ErrVarScopeNotFound = errors.New("tailkit: project/env scope not in vars.toml") ErrPermissionDenied = errors.New("tailkit: ACL cap or node config blocked the operation") )
Functions ¶
This section is empty.
Types ¶
type AllMetrics ¶ added in v0.3.4
type AllMetrics struct {
Host *gopsutilhost.InfoStat `json:"host,omitempty"`
CPU *CPUResult `json:"cpu,omitempty"`
Memory *MemoryResult `json:"memory,omitempty"`
Disk []*gopsutildisk.UsageStat `json:"disk,omitempty"`
Network []gopsutilnet.IOCountersStat `json:"network,omitempty"`
Processes []ProcessStat `json:"processes,omitempty"`
Ports []ListenPort `json:"ports,omitempty"`
} // metrics/handler328
AllMetrics is the typed payload emitted by the metrics all stream.
type Arg ¶
type Arg struct {
// Name is the template variable name used in ExecParts (e.g. "container").
Name string `json:"name"`
// Type is the value type: "string", "int", "bool".
Type string `json:"type"`
// Required indicates the arg must be supplied by the caller.
Required bool `json:"required"`
// Pattern is a regex the value must match before substitution.
// Use the PatternXxx constants or a custom expression.
Pattern string `json:"pattern,omitempty"`
}
Arg describes a single parameter accepted by a Command.
type CPUResult ¶ added in v0.3.4
type CPUResult struct {
Info []gopsutilcpu.InfoStat `json:"info"`
Percent []float64 `json:"percent_per_cpu"`
Total float64 `json:"percent_total"`
}
CPUResult bundles per-CPU usage percentages with static CPU info.
type ComposeService ¶
type DirEntry ¶
type DirEntry struct {
Name string `json:"name"`
Size int64 `json:"size"`
IsDir bool `json:"is_dir"`
ModTime time.Time `json:"mod_time"`
Mode string `json:"mode"`
}
DirEntry is a single entry in a directory listing.
type Job ¶
type Job struct {
// JobID is the opaque identifier used to poll for results.
JobID string `json:"job_id"`
Status JobStatus `json:"status"`
}
Job is the immediate response from a fire-and-forget exec invocation.
type JobEvent ¶ added in v0.3.4
type JobEvent struct {
Event string `json:"-"`
JobID string `json:"job_id"`
Line string `json:"line,omitempty"`
Stream string `json:"stream,omitempty"`
Status JobStatus `json:"status,omitempty"`
ExitCode int `json:"exit_code,omitempty"`
Error string `json:"error,omitempty"`
}
JobEvent is the typed payload emitted by exec job streams. Event identifies the originating SSE event name.
type JobResult ¶
type JobResult struct {
JobID string `json:"job_id"`
Status JobStatus `json:"status"`
ExitCode int `json:"exit_code"`
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
DurationMs int64 `json:"duration_ms"`
// Error is set when the job failed to start (not when the command exits non-zero).
Error string `json:"error,omitempty"`
}
JobResult is returned when polling a completed job.
type JournalEntry ¶ added in v0.3.4
type JournalEntry struct {
Timestamp uint64 `json:"timestamp_us"` // realtime timestamp in microseconds
Message string `json:"message"`
Unit string `json:"unit,omitempty"`
Priority string `json:"priority,omitempty"`
Fields map[string]string `json:"fields,omitempty"`
}
JournalEntry is one systemd journal entry.
type ListenPort ¶ added in v0.3.4
type LogLine ¶ added in v0.3.4
type LogLine struct {
ContainerID string `json:"container_id"`
Stream string `json:"stream"`
TS time.Time `json:"ts"`
Line string `json:"line"`
} // streams.go:18
LogLine is emitted by Docker log streams.
type MemoryResult ¶ added in v0.3.4
type MemoryResult struct {
Virtual *gopsutilmem.VirtualMemoryStat `json:"virtual"`
Swap *gopsutilmem.SwapMemoryStat `json:"swap"`
}
type Peer ¶
type Peer struct {
Status ipnstate.PeerStatus `json:"status"`
Tailkit *TailkitPeer `json:"tailkit"`
}
specific tool installed.
type PortEvent ¶ added in v0.3.4
type PortEvent struct {
Kind string `json:"kind"`
Port ListenPort `json:"port,omitempty"`
Ports []ListenPort `json:"ports,omitempty"`
}
PortEvent is the typed payload emitted by the metrics ports stream. Snapshot events populate Ports; delta events populate Port.
type ProcessStat ¶ added in v0.3.4
type SendDirRequest ¶
type SendDirRequest struct {
// ToolName is the name of the tool that sent the directory.
ToolName string `json:"tool_name"`
// Filename is the name of the file that was sent.
Filename string `json:"filename"`
// LocalDir is the absolute path to the source directory on the caller's machine.
LocalDir string
// DestPath is the absolute destination directory path on the node.
DestPath string
}
SendDirRequest describes a directory tree to push to a remote node.
type SendRequest ¶
type SendRequest struct {
// ToolName is the name of the tool that sent the file.
ToolName string `json:"tool_name"`
// Filename is the name of the file that was sent.
Filename string `json:"filename"`
// LocalPath is the absolute path to the file on the caller's machine.
LocalPath string
// DestPath is the absolute path the file should be written to on the node.
DestPath string
}
SendRequest describes a single file to push to a remote node.
type SendResult ¶
type SendResult struct {
// ToolName is the name of the tool that sent the file.
ToolName string `json:"tool_name"`
// Filename is the name of the file that was sent.
Filename string `json:"filename"`
LocalPath string `json:"local_path"`
// Success indicates whether the file was successfully sent.
Success bool `json:"success"`
// WrittenTo is the absolute path the file was written to on the node.
WrittenTo string `json:"written_to"`
// BytesWritten is the number of bytes written.
BytesWritten int64 `json:"bytes_written"`
// DestMachine is the hostname of the machine the file was sent to.
DestMachine string `json:"dest_machine"`
//Error is set when the file was not successfully sent.
Error string `json:"error,omitempty"`
}
SendResult is the response from a Send or SendDir operation.
type TailkitPeer ¶
type TailkitPeer struct {
Status ipnstate.PeerStatus `json:"status"`
Tools []Tool `json:"tools"`
}
type Tool ¶
type Tool struct {
// Name is a unique identifier for the tool across the tailnet.
Name string `json:"name"`
// Version is the tool's current version string (semver recommended).
Version string `json:"version"`
// TsnetHost is the tsnet hostname this tool registers on the tailnet.
TsnetHost string `json:"tsnet_host"`
}
Tool is the registration record written to /etc/tailkitd/tools/{name}.json by tailkit.Install and read by tailkitd to populate its tool registry.