Documentation
¶
Index ¶
- Constants
- Variables
- func FanOut[T any](ctx context.Context, hostnames []string, ...) (map[string]T, map[string]error)
- func StreamEvents[T any](ctx context.Context, body io.ReadCloser, allowedEvents []string, ...) error
- type AgentListOptions
- type AgentScope
- func (a AgentScope) Events() EventsScope
- func (a AgentScope) Execute(ctx context.Context, cmd string, args []string) ([]byte, error)
- func (a AgentScope) Get(ctx context.Context) (Tailkitd, error)
- func (a AgentScope) Logs() LogsScope
- func (a AgentScope) Restart(ctx context.Context) error
- func (a AgentScope) Services() AgentServicesScope
- func (a AgentScope) Update(ctx context.Context, version string) error
- type AgentServicesScope
- type AgentsScope
- type Arg
- type CPU
- type ClientBackend
- type ComposeScope
- type ComposeService
- type ComposeServicescope
- func (c ComposeServicescope) Build(ctx context.Context) (Job, error)
- func (c ComposeServicescope) Down(ctx context.Context) (Job, error)
- func (c ComposeServicescope) Get(ctx context.Context) (ComposeService, error)
- func (c ComposeServicescope) Pull(ctx context.Context) (Job, error)
- func (c ComposeServicescope) Restart(ctx context.Context) (Job, error)
- func (c ComposeServicescope) Up(ctx context.Context, composeFile string) (Job, error)
- type Container
- type ContainerScope
- func (c ContainerScope) Inspect(ctx context.Context) (container.InspectResponse, error)
- func (c ContainerScope) Logs(ctx context.Context, tailLines int) (io.ReadCloser, error)
- func (c ContainerScope) Remove(ctx context.Context) error
- func (c ContainerScope) Restart(ctx context.Context) error
- func (c ContainerScope) Start(ctx context.Context) error
- func (c ContainerScope) Stop(ctx context.Context) error
- func (d ContainerScope) Stream(ctx context.Context, fn func(Event[DockerEvent]) error) error
- func (c ContainerScope) StreamLogs(ctx context.Context, tail int, fn func(Event[LogLine]) error) error
- func (c ContainerScope) StreamStats(ctx context.Context, fn func(Event[container.StatsResponse]) error) error
- type ContainersNamespace
- type DirEntry
- type DirScope
- type Disk
- type DockerEvent
- type DockerScope
- func (d DockerScope) Compose() ComposeScope
- func (d DockerScope) Config(ctx context.Context) (integrations.DockerConfig, error)
- func (d DockerScope) Container(id string) ContainerScope
- func (d DockerScope) Containers() ContainersNamespace
- func (d DockerScope) Images() ImagesNamespace
- func (d DockerScope) Stream(ctx context.Context, fn func(Event[DockerEvent]) error) error
- func (d DockerScope) Swarm() SwarmScope
- type Event
- type EventsScope
- type FileScope
- func (f FileScope) Config(ctx context.Context) (integrations.FilesConfig, error)
- func (f FileScope) Delete(ctx context.Context) error
- func (f FileScope) Download(ctx context.Context, localDestPath string) error
- func (f FileScope) Read(ctx context.Context) (io.ReadCloser, error)
- func (f FileScope) Send(ctx context.Context, req SendRequest) (SendResult, error)
- func (f FileScope) Stat(ctx context.Context) (FileStat, error)
- func (f FileScope) Write(ctx context.Context, content io.Reader) error
- type FileStat
- type FilesScope
- type FleetFilesScope
- func (ff FleetFilesScope) Config(ctx context.Context) (map[string]integrations.FilesConfig, map[string]error)
- func (ff FleetFilesScope) List(ctx context.Context, path string) (map[string][]DirEntry, map[string]error)
- func (ff FleetFilesScope) Send(ctx context.Context, req SendRequest) (map[string]SendResult, map[string]error)
- func (ff FleetFilesScope) Stat(ctx context.Context, path string) (map[string]FileStat, map[string]error)
- type FleetMetricsScope
- func (fm FleetMetricsScope) All(ctx context.Context) (map[string]Metrics, map[string]error)
- func (fm FleetMetricsScope) CPU(ctx context.Context) (map[string]CPU, map[string]error)
- func (fm FleetMetricsScope) Config(ctx context.Context) (map[string]integrations.MetricsConfig, map[string]error)
- func (fm FleetMetricsScope) Memory(ctx context.Context) (map[string]Memory, map[string]error)
- type FleetVarsScope
- type Host
- type HostListOptions
- type HostScope
- func (h HostScope) Agent() AgentScope
- func (h HostScope) Docker() DockerScope
- func (h HostScope) Files() FilesScope
- func (h HostScope) Get(ctx context.Context) (Host, error)
- func (h HostScope) Metrics() MetricsScope
- func (h HostScope) Systemd() SystemdScope
- func (h HostScope) Vars(Service, env string) VarsScope
- type HostsScope
- type Image
- type ImagesNamespace
- type Job
- type JobResult
- type JobStatus
- type JobUpdate
- type JournalEntry
- type LogLine
- type LogsScope
- type Memory
- type Metrics
- type MetricsScope
- func (m MetricsScope) All(ctx context.Context, fn func(Event[Metrics]) error) error
- func (m MetricsScope) CPU(ctx context.Context) (CPU, error)
- func (m MetricsScope) Disk(ctx context.Context) ([]Disk, error)
- func (m MetricsScope) Memory(ctx context.Context) (Memory, error)
- func (m MetricsScope) Network(ctx context.Context) ([]Network, error)
- func (m MetricsScope) Ports(ctx context.Context) ([]Port, error)
- func (m MetricsScope) Processes(ctx context.Context) ([]Process, error)
- func (m MetricsScope) Stream() MetricsStreamScope
- type MetricsStreamScope
- type Network
- type Peer
- type PeerListOptions
- type PeerScope
- type PeersScope
- type Port
- type PortUpdate
- type Process
- type RawEvent
- type SendDirRequest
- type SendRequest
- type SendResult
- type Service
- type ServiceCapabilities
- type ServiceListOptions
- type ServiceScope
- func (s ServiceScope) Get(ctx context.Context) (Service, error)
- func (s ServiceScope) Host() HostScope
- func (s ServiceScope) Logs(ctx context.Context, tailLines int) (io.ReadCloser, error)
- func (s ServiceScope) Reload(ctx context.Context) error
- func (s ServiceScope) Restart(ctx context.Context) error
- func (s ServiceScope) Start(ctx context.Context) error
- func (s ServiceScope) Stop(ctx context.Context) error
- type ServiceStatus
- type ServicesScope
- type SwarmScope
- type SwarmServicesNamespace
- type SwarmStatus
- type SwarmStreamScope
- type SwarmUpdate
- type SwarwService
- type SystemdScope
- type SystemdStreamScope
- type SystemdUnit
- type Tailkitd
- type TailnetClient
- type Tool
- type UnitScope
- func (u UnitScope) Disable(ctx context.Context) error
- func (u UnitScope) Enable(ctx context.Context) error
- func (u UnitScope) File(ctx context.Context) (string, error)
- func (u UnitScope) Get(ctx context.Context) (map[string]any, error)
- func (u UnitScope) Journal(ctx context.Context, lines int) ([]JournalEntry, error)
- func (u UnitScope) Reload(ctx context.Context) error
- func (u UnitScope) Restart(ctx context.Context) error
- func (u UnitScope) Start(ctx context.Context) error
- func (u UnitScope) Status(ctx context.Context) (SystemdUnit, error)
- func (u UnitScope) Stop(ctx context.Context) error
- func (u UnitScope) Stream() UnitStreamScope
- type UnitStreamScope
- type UnitsNamespace
- type VarsScope
Constants ¶
const ( EventError = "error" EventJobStdout = "job.stdout" EventJobStderr = "job.stderr" EventJobStatus = "job.status" EventJobCompleted = "job.completed" EventJobFailed = "job.failed" EventDockerContainer = "docker.container" EventDockerAll = "docker.all" EventLogLine = "log.line" EventStatsSnapshot = "stats.snapshot" EventJournalEntry = "journal.entry" EventCPU = "metrics.cpu" EventMemory = "metrics.memory" EventNetwork = "metrics.network" EventProcesses = "metrics.processes" EventAll = "metrics.all" EventPortsSnapshot = "ports.snapshot" EventPortBound = "port.bound" EventPortReleased = "port.released" )
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") ErrConflict = errors.New("tailkit: conflict") )
Functions ¶
Types ¶
type AgentListOptions ¶
type AgentListOptions struct {
Online bool
}
type AgentScope ¶
type AgentScope struct {
Backend ClientBackend
Hostname string
}
func (AgentScope) Events ¶
func (a AgentScope) Events() EventsScope
func (AgentScope) Logs ¶
func (a AgentScope) Logs() LogsScope
func (AgentScope) Services ¶
func (a AgentScope) Services() AgentServicesScope
type AgentServicesScope ¶
type AgentServicesScope struct {
Backend ClientBackend
Hostname string
}
AgentServicesScope is the concrete struct for an agent's local workloads.
func (AgentServicesScope) List ¶
func (s AgentServicesScope) List(ctx context.Context, opts ...ServiceListOptions) ([]Service, error)
type AgentsScope ¶
type AgentsScope struct {
Backend ClientBackend
Hostnames []string
}
func (AgentsScope) List ¶
func (h AgentsScope) List(ctx context.Context, opts ...AgentListOptions) (map[string]Tailkitd, map[string]error)
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 CPU ¶
type CPU struct {
Info []gopsutilcpu.InfoStat `json:"info"`
Percent []float64 `json:"percent_per_cpu"`
Total float64 `json:"percent_total"`
}
CPU bundles per-CPU usage percentages with static CPU info.
type ClientBackend ¶
type ClientBackend interface {
// Do executes an HTTP request against a specific node and decodes JSON into 'out'
Do(ctx context.Context, hostname, method, path string, body io.Reader, out any) error
// DoRaw executes a request and returns the raw bytes (useful for files/logs)
DoRaw(ctx context.Context, hostname, method, path string, body io.Reader, accept string) ([]byte, error)
// Stream opens an SSE or continuous log stream
Stream(ctx context.Context, hostname, method, path string) (io.ReadCloser, error)
Peers(ctx context.Context, opts *PeerListOptions) ([]string, error)
Hosts(ctx context.Context, opts *HostListOptions) ([]string, error)
Agents(ctx context.Context, opts *AgentListOptions) ([]string, error)
}
ClientBackend defines the underlying network transport layer. All concrete scopes will hold a pointer to this to execute requests.
type ComposeScope ¶
type ComposeScope struct {
Backend ClientBackend
Hostname string
}
Compose
func (ComposeScope) Service ¶ added in v0.5.2
func (c ComposeScope) Service(name string) ComposeServicescope
func (ComposeScope) Services ¶ added in v0.5.2
func (c ComposeScope) Services(ctx context.Context) ([]ComposeService, error)
type ComposeService ¶
type ComposeServicescope ¶ added in v0.5.2
type ComposeServicescope struct {
Backend ClientBackend
Hostname string
ServiceName string
}
func (ComposeServicescope) Build ¶ added in v0.5.2
func (c ComposeServicescope) Build(ctx context.Context) (Job, error)
func (ComposeServicescope) Down ¶ added in v0.5.2
func (c ComposeServicescope) Down(ctx context.Context) (Job, error)
func (ComposeServicescope) Get ¶ added in v0.5.2
func (c ComposeServicescope) Get(ctx context.Context) (ComposeService, error)
func (ComposeServicescope) Pull ¶ added in v0.5.2
func (c ComposeServicescope) Pull(ctx context.Context) (Job, error)
type ContainerScope ¶
type ContainerScope struct {
Backend ClientBackend
Hostname string
ContainerID string
}
Container Actions
func (ContainerScope) Inspect ¶
func (c ContainerScope) Inspect(ctx context.Context) (container.InspectResponse, error)
func (ContainerScope) Logs ¶
func (c ContainerScope) Logs(ctx context.Context, tailLines int) (io.ReadCloser, error)
func (ContainerScope) Stream ¶ added in v0.5.2
func (d ContainerScope) Stream(ctx context.Context, fn func(Event[DockerEvent]) error) error
func (ContainerScope) StreamLogs ¶
func (c ContainerScope) StreamLogs(ctx context.Context, tail int, fn func(Event[LogLine]) error) error
Stream logs for a specific container
func (ContainerScope) StreamStats ¶
func (c ContainerScope) StreamStats(ctx context.Context, fn func(Event[container.StatsResponse]) error) error
Stream stats for a specific container
type ContainersNamespace ¶
type ContainersNamespace struct {
Backend ClientBackend
Hostname string
}
Containers
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 DirScope ¶
type DirScope struct {
Backend ClientBackend
Hostname string
Path string
}
func (DirScope) Send ¶
func (d DirScope) Send(ctx context.Context, req SendDirRequest) ([]SendResult, error)
type Disk ¶
type Disk = *gopsutildisk.UsageStat
type DockerEvent ¶
type DockerScope ¶
type DockerScope struct {
Backend ClientBackend
Hostname string
}
========================================== Integration Scopes (Concrete) ==========================================
func (DockerScope) Compose ¶
func (d DockerScope) Compose() ComposeScope
func (DockerScope) Config ¶ added in v0.5.2
func (d DockerScope) Config(ctx context.Context) (integrations.DockerConfig, error)
func (DockerScope) Container ¶
func (d DockerScope) Container(id string) ContainerScope
func (DockerScope) Containers ¶
func (d DockerScope) Containers() ContainersNamespace
func (DockerScope) Images ¶
func (d DockerScope) Images() ImagesNamespace
func (DockerScope) Stream ¶
func (d DockerScope) Stream(ctx context.Context, fn func(Event[DockerEvent]) error) error
func (DockerScope) Swarm ¶
func (d DockerScope) Swarm() SwarmScope
type EventsScope ¶
type EventsScope struct {
Backend ClientBackend
Hostname string
}
func (EventsScope) Stream ¶
func (e EventsScope) Stream(ctx context.Context) (io.ReadCloser, error)
type FileScope ¶
type FileScope struct {
Backend ClientBackend
Hostname string
Path string
}
func (FileScope) Config ¶
func (f FileScope) Config(ctx context.Context) (integrations.FilesConfig, error)
func (FileScope) Send ¶
func (f FileScope) Send(ctx context.Context, req SendRequest) (SendResult, error)
type FilesScope ¶
type FilesScope struct {
Backend ClientBackend
Hostname string
}
Files
func (FilesScope) Dir ¶
func (f FilesScope) Dir(path string) DirScope
func (FilesScope) File ¶
func (f FilesScope) File(path string) FileScope
type FleetFilesScope ¶
type FleetFilesScope struct {
Backend ClientBackend
Hostnames []string
}
func (FleetFilesScope) Config ¶
func (ff FleetFilesScope) Config(ctx context.Context) (map[string]integrations.FilesConfig, map[string]error)
func (FleetFilesScope) Send ¶
func (ff FleetFilesScope) Send(ctx context.Context, req SendRequest) (map[string]SendResult, map[string]error)
type FleetMetricsScope ¶
type FleetMetricsScope struct {
Backend ClientBackend
Hostnames []string
}
func (FleetMetricsScope) Config ¶
func (fm FleetMetricsScope) Config(ctx context.Context) (map[string]integrations.MetricsConfig, map[string]error)
type FleetVarsScope ¶
type FleetVarsScope struct {
Backend ClientBackend
Hostnames []string
Service string
Env string
}
func (FleetVarsScope) Config ¶
func (fv FleetVarsScope) Config(ctx context.Context) (map[string]integrations.VarsConfig, map[string]error)
type Host ¶
type Host struct {
Name string `json:"name"`
Role string `json:"role"`
Environment string `json:"environment"`
Provider string `json:"provider"`
InstanceType string `json:"instance_type"`
Tags []string `json:"tags"`
Metadata map[string]string `json:"metadata"`
Peer *Peer `json:"peer,omitempty"`
Tailkitd *Tailkitd `json:"tailkitd,omitempty"`
TSHostname string `json:"ts_hostname"`
TSDNSName string `json:"ts_dns_name"`
TSIPs []string `json:"ts_ips"`
OS string `json:"os"`
Arch string `json:"arch"`
Online bool `json:"online"`
IsAdmin bool `json:"is_admin"`
}
Host is a tailnet peer that has an associated tailkitd sidecar.
func (*Host) IsClassified ¶
IsClassified reports whether an admin has assigned a non-default role.
type HostListOptions ¶
type HostScope ¶
type HostScope struct {
Backend ClientBackend
Hostname string
}
func (HostScope) Agent ¶
func (h HostScope) Agent() AgentScope
func (HostScope) Docker ¶
func (h HostScope) Docker() DockerScope
func (HostScope) Files ¶
func (h HostScope) Files() FilesScope
func (HostScope) Metrics ¶
func (h HostScope) Metrics() MetricsScope
func (HostScope) Systemd ¶
func (h HostScope) Systemd() SystemdScope
type HostsScope ¶
type HostsScope struct {
Backend ClientBackend
Hostnames []string
}
func (HostsScope) Files ¶
func (h HostsScope) Files() FleetFilesScope
func (HostsScope) List ¶
func (h HostsScope) List(ctx context.Context, opts ...HostListOptions) (map[string]Host, map[string]error)
func (HostsScope) Metrics ¶
func (h HostsScope) Metrics() FleetMetricsScope
func (HostsScope) Vars ¶
func (h HostsScope) Vars(Service, env string) FleetVarsScope
type ImagesNamespace ¶
type ImagesNamespace struct {
Backend ClientBackend
Hostname string
}
Images
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 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 JobUpdate ¶
type JobUpdate 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"`
}
JobUpdate is the typed payload emitted by exec job streams. Event identifies the originating SSE event name.
type JournalEntry ¶
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 LogLine ¶
type LogLine struct {
ContainerID string `json:"container_id"`
Stream string `json:"stream"`
TS time.Time `json:"ts"`
Line string `json:"line"`
}
LogLine is emitted by Docker log streams.
type Memory ¶
type Memory struct {
Virtual *gopsutilmem.VirtualMemoryStat `json:"virtual"`
Swap *gopsutilmem.SwapMemoryStat `json:"swap"`
}
type Metrics ¶
type Metrics struct {
Host *gopsutilhost.InfoStat `json:"host,omitempty"`
CPU *CPU `json:"cpu,omitempty"`
Memory *Memory `json:"memory,omitempty"`
Disk []*gopsutildisk.UsageStat `json:"disk,omitempty"`
Network []gopsutilnet.IOCountersStat `json:"network,omitempty"`
Processes []Process `json:"processes,omitempty"`
Ports []Port `json:"ports,omitempty"`
} // metrics/handler328
Metrics is the typed payload emitted by the metrics all stream.
type MetricsScope ¶
type MetricsScope struct {
Backend ClientBackend
Hostname string
}
Metrics
func (MetricsScope) Ports ¶ added in v0.5.2
func (m MetricsScope) Ports(ctx context.Context) ([]Port, error)
func (MetricsScope) Processes ¶
func (m MetricsScope) Processes(ctx context.Context) ([]Process, error)
func (MetricsScope) Stream ¶ added in v0.5.2
func (m MetricsScope) Stream() MetricsStreamScope
type MetricsStreamScope ¶ added in v0.5.2
type MetricsStreamScope struct {
Backend ClientBackend
Hostname string
}
func (MetricsStreamScope) Ports ¶ added in v0.5.2
func (m MetricsStreamScope) Ports(ctx context.Context, fn func(Event[PortUpdate]) error) error
type Network ¶
type Network = gopsutilnet.IOCountersStat
type Peer ¶
type Peer struct {
ID string `json:"id,omitempty"`
PublicKey string `json:"public_key,omitempty"`
HostName string `json:"host_name,omitempty"`
DNSName string `json:"dns_name,omitempty"`
IPs []string `json:"ips"`
OS string `json:"os,omitempty"`
Online bool `json:"online"`
Metadata map[string]string `json:"metadata,omitempty"`
// Status keeps the raw Tailscale peer payload available for local SDK
// enrichment and classification without making it part of the shared wire
// contract.
Status *ipnstate.PeerStatus `json:"-"`
}
Peer is a tailnet machine identity as reported by Tailscale.
type PeerListOptions ¶
type PeerListOptions struct{ Online bool }
type PeerScope ¶
type PeerScope struct {
Backend ClientBackend
Hostname string
}
type PeersScope ¶
type PeersScope struct {
Backend ClientBackend
Hostnames []string
}
func (PeersScope) List ¶
func (h PeersScope) List(ctx context.Context, opt PeerListOptions) (map[string]Peer, map[string]error)
type PortUpdate ¶
type PortUpdate struct {
Kind string `json:"kind"`
Port Port `json:"port,omitempty"`
Ports []Port `json:"ports,omitempty"`
}
PortUpdate is the typed payload emitted by the metrics ports stream. Snapshot events populate Ports; delta events populate Port.
type RawEvent ¶
type RawEvent struct {
Name string
ID int64
Data json.RawMessage
}
RawEvent is the parser-side SSE envelope used before typed decoding.
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 Service ¶
type Service struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Kind string `json:"kind,omitempty"`
Runtime string `json:"runtime"`
HostName string `json:"host_name,omitempty"`
NodeName string `json:"node_name,omitempty"`
Description string `json:"description,omitempty"`
Source string `json:"source,omitempty"`
Priority string `json:"priority,omitempty"`
Tags []string `json:"tags"`
Version string `json:"version,omitempty"`
Addresses []string `json:"addresses"`
Ports []uint16 `json:"ports"`
ExpectedPorts []uint16 `json:"expected_ports,omitempty"`
SystemdUnit string `json:"systemd_unit,omitempty"`
ContainerID string `json:"container_id,omitempty"`
BinaryPath string `json:"binary_path,omitempty"`
PidFile string `json:"pid_file,omitempty"`
Capabilities ServiceCapabilities `json:"capabilities"`
Status ServiceStatus `json:"status"`
}
Service represents a workload declared on a tailkitd node.
type ServiceCapabilities ¶
type ServiceCapabilities struct {
Status bool `json:"status"`
Start bool `json:"start"`
Stop bool `json:"stop"`
Restart bool `json:"restart"`
Reload bool `json:"reload"`
Logs bool `json:"logs"`
}
ServiceCapabilities describes which portable service operations are exposed.
type ServiceListOptions ¶
type ServiceScope ¶
type ServiceScope struct {
Backend ClientBackend
ServiceID string
}
func (ServiceScope) Host ¶
func (s ServiceScope) Host() HostScope
func (ServiceScope) Logs ¶
func (s ServiceScope) Logs(ctx context.Context, tailLines int) (io.ReadCloser, error)
type ServiceStatus ¶
type ServiceStatus struct {
State string `json:"state,omitempty"`
Health string `json:"health,omitempty"`
Message string `json:"message,omitempty"`
PID int `json:"pid,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
}
ServiceStatus is the current runtime state of a service-like workload.
type ServicesScope ¶
type ServicesScope struct {
Backend ClientBackend
TargetIDs []string
}
func (ServicesScope) List ¶
func (s ServicesScope) List(ctx context.Context, opts ...AgentListOptions) (map[string][]Service, map[string]error)
type SwarmScope ¶
type SwarmScope struct {
Backend ClientBackend
Hostname string
}
Swarm
func (SwarmScope) Services ¶ added in v0.5.2
func (s SwarmScope) Services() SwarmServicesNamespace
func (SwarmScope) Status ¶
func (s SwarmScope) Status(ctx context.Context) (SwarmStatus, error)
func (SwarmScope) Stream ¶ added in v0.5.2
func (s SwarmScope) Stream() SwarmStreamScope
type SwarmServicesNamespace ¶ added in v0.5.2
type SwarmServicesNamespace struct {
Backend ClientBackend
Hostname string
}
func (SwarmServicesNamespace) List ¶ added in v0.5.2
func (s SwarmServicesNamespace) List(ctx context.Context) ([]SwarwService, error)
type SwarmStreamScope ¶ added in v0.5.2
type SwarmStreamScope struct {
ID string
Backend ClientBackend
Hostname string
}
type SwarmUpdate ¶ added in v0.5.2
type SwarwService ¶ added in v0.5.2
type SystemdScope ¶
type SystemdScope struct {
Backend ClientBackend
Hostname string
}
Systemd
func (SystemdScope) Stream ¶ added in v0.5.2
func (s SystemdScope) Stream() SystemdStreamScope
func (SystemdScope) SystemJournal ¶
func (s SystemdScope) SystemJournal(ctx context.Context, lines int) ([]JournalEntry, error)
func (SystemdScope) Unit ¶
func (s SystemdScope) Unit(name string) UnitScope
func (SystemdScope) Units ¶
func (s SystemdScope) Units() UnitsNamespace
type SystemdStreamScope ¶ added in v0.5.2
type SystemdStreamScope struct {
Backend ClientBackend
Hostname string
}
func (SystemdStreamScope) System ¶ added in v0.5.2
func (s SystemdStreamScope) System(ctx context.Context, lines int, fn func(Event[JournalEntry]) error) error
type SystemdUnit ¶
type SystemdUnit = dbus.UnitStatus
SystemdUnit aliases the CoreOS D-Bus unit status.
type Tailkitd ¶
type Tailkitd struct {
HostName string `json:"host_name,omitempty"`
Peer *Peer `json:"peer,omitempty"`
Services []Service `json:"services"`
}
Tailkitd is a tailkitd-* tsnet sidecar peer that manages one host.
type TailnetClient ¶
type TailnetClient interface {
// Plural Namespaces (Optional variadic targets for fleet fan-outs)
Peers(hostnames ...string) PeersScope
Hosts(hostnames ...string) HostsScope
Agents(hostnames ...string) AgentsScope
Services(serviceIDs ...string) ServicesScope
// Singular Namespaces
Peer(hostname string) PeerScope
Host(hostname string) HostScope
Agent(hostname string) AgentScope
Service(serviceID string) ServiceScope
}
========================================== Top-Level Tailnet Client (Mockable) ==========================================
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.
type UnitScope ¶
type UnitScope struct {
Backend ClientBackend
Hostname string
UnitName string
}
func (UnitScope) Stream ¶ added in v0.5.2
func (u UnitScope) Stream() UnitStreamScope
type UnitStreamScope ¶ added in v0.5.2
type UnitStreamScope struct {
Backend ClientBackend
Hostname string
UnitName string
}
func (UnitStreamScope) Journal ¶ added in v0.5.2
func (u UnitStreamScope) Journal(ctx context.Context, lines int, fn func(Event[JournalEntry]) error) error
type UnitsNamespace ¶
type UnitsNamespace struct {
Backend ClientBackend
Hostname string
}
func (UnitsNamespace) List ¶
func (u UnitsNamespace) List(ctx context.Context) ([]SystemdUnit, error)