From b88b4cce750cdfa9e24449e20895defbdc2dbc95 Mon Sep 17 00:00:00 2001 From: Timothy Messier Date: Thu, 25 May 2023 13:44:19 +0000 Subject: [PATCH] feat(bsr/ssh): Add file transfer direction to channel summary When an SSH channel is used for a file transfer, the summary will report the detected direction of the file transfer as either an upload or download, relative to the end client. --- internal/bsr/ssh/types.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/internal/bsr/ssh/types.go b/internal/bsr/ssh/types.go index 072ae6903f..40e60c0b9d 100644 --- a/internal/bsr/ssh/types.go +++ b/internal/bsr/ssh/types.go @@ -59,6 +59,16 @@ func ValidExecApplicationProgram(d ExecApplicationProgram) bool { return false } +// FileTransferDirection indicates the direction of a file transfer. +type FileTransferDirection string + +// Valid file transfer directions. +const ( + FileTransferNotApplicable FileTransferDirection = "not applicable" + FileTransferUpload FileTransferDirection = "upload" + FileTransferDownload FileTransferDirection = "download" +) + // ChannelSummary encapsulates data for a channel // SessionProgram can only be one of the following: exec, shell, or subsystem // SubsystemName is only populated if SessionProgram is subsystem @@ -66,8 +76,9 @@ func ValidExecApplicationProgram(d ExecApplicationProgram) bool { // // scp, rsync, or unknown type ChannelSummary struct { - ChannelSummary *bsr.ChannelSummary - SessionProgram SessionProgram - SubsystemName string - ExecProgram ExecApplicationProgram + ChannelSummary *bsr.ChannelSummary + SessionProgram SessionProgram + SubsystemName string + ExecProgram ExecApplicationProgram + FileTransferDirection FileTransferDirection }