From 280432707439921bc4de56d55a63c4886cdb0cbf Mon Sep 17 00:00:00 2001 From: Charlotte Brandhorst-Satzkorn Date: Thu, 4 May 2023 18:08:11 -0700 Subject: [PATCH] tailcfg: update rename SSHFailureNotifyRequest and add EventType This change renames SSHFailureNotifyRequest to SSHEventNotifyRequest to better reflect the additional events we could add in the future. This change also adds an EventType used to catagories the events. Updates tailscale/corp#9967 Signed-off-by: Charlotte Brandhorst-Satzkorn --- tailcfg/tailcfg.go | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tailcfg/tailcfg.go b/tailcfg/tailcfg.go index b77193f2b..6e4b20b38 100644 --- a/tailcfg/tailcfg.go +++ b/tailcfg/tailcfg.go @@ -2075,9 +2075,11 @@ type SSHRecorderFailureAction struct { NotifyURL string `json:",omitempty"` } -// SSHRecordingFailureNotifyRequest is the JSON payload sent to the NotifyURL -// when a recording fails. -type SSHRecordingFailureNotifyRequest struct { +// SSHEventNotifyRequest is the JSON payload sent to the NotifyURL +// for an SSH event. +type SSHEventNotifyRequest struct { + // EventType is the type of notify request being sent. + EventType SSHEventType // CapVersion is the client's current CapabilityVersion. CapVersion CapabilityVersion @@ -2093,10 +2095,19 @@ type SSHRecordingFailureNotifyRequest struct { // LocalUser is the user that was resolved from the SSHUser for the local machine. LocalUser string - // Attempts is the list of recorders that were attempted, in order. - Attempts []SSHRecordingAttempt + // RecordingAttempts is the list of recorders that were attempted, in order. + RecordingAttempts []*SSHRecordingAttempt } +// SSHEventType defines the event type linked to a SSH action or state. +type SSHEventType int + +const ( + UnspecifiedSSHEventType SSHEventType = 0 + SSHSessionRecordingRejected SSHEventType = 1 + SSHSessionRecordingTerminated SSHEventType = 2 +) + // SSHRecordingAttempt is a single attempt to start a recording. type SSHRecordingAttempt struct { // Recorder is the address of the recorder that was attempted.