header.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // Copyright (c) Tailscale Inc & AUTHORS
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. package sessionrecording
  4. import "tailscale.com/tailcfg"
  5. // CastHeader is the header of an asciinema file.
  6. type CastHeader struct {
  7. // Version is the asciinema file format version.
  8. Version int `json:"version"`
  9. // Width is the terminal width in characters.
  10. // It is non-zero for Pty sessions.
  11. Width int `json:"width"`
  12. // Height is the terminal height in characters.
  13. // It is non-zero for Pty sessions.
  14. Height int `json:"height"`
  15. // Timestamp is the unix timestamp of when the recording started.
  16. Timestamp int64 `json:"timestamp"`
  17. // Command is the command that was executed.
  18. // Typically empty for shell sessions.
  19. Command string `json:"command,omitempty"`
  20. // SrcNode is the FQDN of the node originating the connection.
  21. // It is also the MagicDNS name for the node.
  22. // It does not have a trailing dot.
  23. // e.g. "host.tail-scale.ts.net"
  24. SrcNode string `json:"srcNode"`
  25. // SrcNodeID is the node ID of the node originating the connection.
  26. SrcNodeID tailcfg.StableNodeID `json:"srcNodeID"`
  27. // Tailscale-specific fields:
  28. // SrcNodeTags is the list of tags on the node originating the connection (if any).
  29. SrcNodeTags []string `json:"srcNodeTags,omitempty"`
  30. // SrcNodeUserID is the user ID of the node originating the connection (if not tagged).
  31. SrcNodeUserID tailcfg.UserID `json:"srcNodeUserID,omitempty"` // if not tagged
  32. // SrcNodeUser is the LoginName of the node originating the connection (if not tagged).
  33. SrcNodeUser string `json:"srcNodeUser,omitempty"`
  34. // Fields that are only set for Tailscale SSH session recordings:
  35. // Env is the environment variables of the session.
  36. // Only "TERM" is set (2023-03-22).
  37. Env map[string]string `json:"env"`
  38. // SSHUser is the username as presented by the client.
  39. SSHUser string `json:"sshUser"` // as presented by the client
  40. // LocalUser is the effective username on the server.
  41. LocalUser string `json:"localUser"`
  42. // ConnectionID uniquely identifies a connection made to the SSH server.
  43. // It may be shared across multiple sessions over the same connection in
  44. // case of SSH multiplexing.
  45. ConnectionID string `json:"connectionID"`
  46. // Fields that are only set for Kubernetes API server proxy session recordings:
  47. Kubernetes *Kubernetes `json:"kubernetes,omitempty"`
  48. }
  49. // Kubernetes contains 'kubectl exec/attach' session specific information for
  50. // tsrecorder.
  51. type Kubernetes struct {
  52. // PodName is the name of the Pod the session was recorded for.
  53. PodName string
  54. // Namespace is the namespace in which the Pod the session was recorded for exists in.
  55. Namespace string
  56. // Container is the container the session was recorded for.
  57. Container string
  58. // SessionType is the type of session that was executed (e.g., exec, attach)
  59. SessionType string
  60. }