Movatterモバイル変換


[0]ホーム

URL:


sessionrecording

package
v1.92.3Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License:BSD-3-ClauseImports:15Imported by:6

Details

Repository

github.com/tailscale/tailscale

Links

Documentation

Overview

Package sessionrecording contains session recording utils shared amongstTailscale SSH and Kubernetes API server proxy session recording.

Index

Constants

View Source
const (KubernetesAPIEventType = "kubernetes-api-request")

Variables

This section is empty.

Functions

funcConnectToRecorder

func ConnectToRecorder(ctxcontext.Context, recs []netip.AddrPort, dialnetx.DialFunc) (io.WriteCloser, []*tailcfg.SSHRecordingAttempt, <-chanerror,error)

ConnectToRecorder connects to the recorder at any of the provided addresses.It returns the first successful response, or a multierr if all attempts fail.

On success, it returns a WriteCloser that can be used to upload therecording, and a channel that will be sent an error (or nil) when the uploadfails or completes.

In both cases, a slice of SSHRecordingAttempts is returned which detail theattempted recorder IP and the error message, if the attempt failed. Theattempts are in order the recorder(s) was attempted. If successful asuccessful connection is made, the last attempt in the slice is theattempt for connected recorder.

funcSendEventadded inv1.90.0

func SendEvent(apnetip.AddrPort, eventio.Reader, dialnetx.DialFunc) (retErrerror)

SendEvent sends an event the tsrecorders /v2/event endpoint.

Types

typeCastHeader

type CastHeader struct {// Version is the asciinema file format version.Versionint `json:"version"`// Width is the terminal width in characters.// It is non-zero for Pty sessions.Widthint `json:"width"`// Height is the terminal height in characters.// It is non-zero for Pty sessions.Heightint `json:"height"`// Timestamp is the unix timestamp of when the recording started.Timestampint64 `json:"timestamp"`// Command is the command that was executed.// Typically empty for shell sessions.Commandstring `json:"command,omitempty"`// SrcNode is the FQDN of the node originating the connection.// It is also the MagicDNS name for the node.// It does not have a trailing dot.// e.g. "host.tail-scale.ts.net"SrcNodestring `json:"srcNode"`// SrcNodeID is the node ID of the node originating the connection.SrcNodeIDtailcfg.StableNodeID `json:"srcNodeID"`// Tailscale-specific fields:// SrcNodeTags is the list of tags on the node originating the connection (if any).SrcNodeTags []string `json:"srcNodeTags,omitempty"`// SrcNodeUserID is the user ID of the node originating the connection (if not tagged).SrcNodeUserIDtailcfg.UserID `json:"srcNodeUserID,omitempty"`// if not tagged// SrcNodeUser is the LoginName of the node originating the connection (if not tagged).SrcNodeUserstring `json:"srcNodeUser,omitempty"`// Env is the environment variables of the session.// Only "TERM" is set (2023-03-22).Env map[string]string `json:"env"`// SSHUser is the username as presented by the client.SSHUserstring `json:"sshUser"`// as presented by the client// LocalUser is the effective username on the server.LocalUserstring `json:"localUser"`// ConnectionID uniquely identifies a connection made to the SSH server.// It may be shared across multiple sessions over the same connection in// case of SSH multiplexing.ConnectionIDstring `json:"connectionID"`// Fields that are only set for Kubernetes API server proxy session recordings:Kubernetes *Kubernetes `json:"kubernetes,omitempty"`}

CastHeader is the header of an asciinema file.

typeDestinationadded inv1.90.0

type Destination struct {// Node is the FQDN of the node receiving the connection.// It is also the MagicDNS name for the node.// It does not have a trailing dot.// e.g. "host.tail-scale.ts.net"Nodestring `json:"node"`// NodeID is the node ID of the node receiving the connection.NodeIDtailcfg.StableNodeID `json:"nodeID"`}

typeEventadded inv1.90.0

type Event struct {// Type specifies the kind of event being recorded (e.g., "kubernetes-api-request").Typestring `json:"type"`// ID is a reference of the path that this event is stored at in tsrecorderIDstring `json:"id"`// Timestamp is the time when the event was recorded represented as a unix timestamp.Timestampint64 `json:"timestamp"`// UserAgent is the UerAgent specified in the request, which helps identify// the client software that initiated the request.UserAgentstring `json:"userAgent"`// Request holds details of the HTTP request.RequestRequest `json:"request"`// Kubernetes contains Kubernetes-specific information about the request (if// the type is `kubernetes-api-request`)KubernetesKubernetesRequestInfo `json:"kubernetes"`// Source provides details about the client that initiated the request.SourceSource `json:"source"`// Destination provides details about the node receiving the request.DestinationDestination `json:"destination"`}

Event represents the top-level structure of a tsrecorder event.

typeEventAPINotSupportedErradded inv1.90.0

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

func (EventAPINotSupportedErr)Erroradded inv1.90.0

typeKubernetes

type Kubernetes struct {// PodName is the name of the Pod the session was recorded for.PodNamestring// Namespace is the namespace in which the Pod the session was recorded for exists in.Namespacestring// Container is the container the session was recorded for.Containerstring// SessionType is the type of session that was executed (e.g., exec, attach)SessionTypestring}

Kubernetes contains 'kubectl exec/attach' session specific information fortsrecorder.

typeKubernetesRequestInfoadded inv1.90.0

type KubernetesRequestInfo struct {// IsResourceRequest indicates whether or not the request is for an API resource or subresourceIsResourceRequestbool// Path is the URL path of the requestPathstring// Verb is the kube verb associated with the request for API requests, not the http verb.  This includes things like list and watch.// for non-resource requests, this is the lowercase http verbVerbstringAPIPrefixstringAPIGroupstringAPIVersionstringNamespacestring// Resource is the name of the resource being requested.  This is not the kind.  For example: podsResourcestring// Subresource is the name of the subresource being requested.  This is a different resource, scoped to the parent resource, but it may have a different kind.// For instance, /pods has the resource "pods" and the kind "Pod", while /pods/foo/status has the resource "pods", the sub resource "status", and the kind "Pod"// (because status operates on pods). The binding resource for a pod though may be /pods/foo/binding, which has resource "pods", subresource "binding", and kind "Binding".Subresourcestring// Name is empty for some verbs, but if the request directly indicates a name (not in body content) then this field is filled in.Namestring// Parts are the path parts for the request, always starting with /{resource}/{name}Parts []string// FieldSelector contains the unparsed field selector from a request.  It is only present if the apiserver// honors field selectors for the verb this request is associated with.FieldSelectorstring// LabelSelector contains the unparsed field selector from a request.  It is only present if the apiserver// honors field selectors for the verb this request is associated with.LabelSelectorstring}

copied fromhttps://github.com/kubernetes/kubernetes/blob/11ade2f7dd264c2f52a4a1342458abbbaa3cb2b1/staging/src/k8s.io/apiserver/pkg/endpoints/request/requestinfo.go#L44KubernetesRequestInfo contains Kubernetes specific information in the request (if the type is `kubernetes-api-request`)

typeRequestadded inv1.90.0

type Request struct {Methodstring     `json:"method"`Pathstring     `json:"path"`Body            []byte     `json:"body"`QueryParametersurl.Values `json:"queryParameters"`}

Request holds information about a request.

typeSourceadded inv1.90.0

type Source struct {// Node is the FQDN of the node originating the connection.// It is also the MagicDNS name for the node.// It does not have a trailing dot.// e.g. "host.tail-scale.ts.net"Nodestring `json:"node"`// NodeID is the node ID of the node originating the connection.NodeIDtailcfg.StableNodeID `json:"nodeID"`// Tailscale-specific fields:// NodeTags is the list of tags on the node originating the connection (if any).NodeTags []string `json:"nodeTags,omitempty"`// NodeUserID is the user ID of the node originating the connection (if not tagged).NodeUserIDtailcfg.UserID `json:"nodeUserID,omitempty"`// if not tagged// NodeUser is the LoginName of the node originating the connection (if not tagged).NodeUserstring `json:"nodeUser,omitempty"`}

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp