message

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2021 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelID

type ChannelID *uint64

ChannelID is the ID of an SSH channel

func MakeChannelID added in v0.9.1

func MakeChannelID(n uint64) ChannelID

type ConnectionID

type ConnectionID string

ConnectionID is an opaque, globally unique identifier for a connection made to the SSH server

type DocField added in v0.9.8

type DocField struct {
	Name     string
	DataType string
	Comment  string
	Embedded *DocStruct
}

DocField is a record if documentation inside a struct.

type DocStruct added in v0.9.8

type DocStruct struct {
	Name        string
	Description string
	Fields      []DocField
}

DocStruct documents a structure.

type DocType added in v0.9.8

type DocType struct {
	Type

	Description string
}

DocType contains an extra description for types.

type Documentation added in v0.9.8

type Documentation struct {
	// Message is the main message object
	Message DocStruct
	// Payloads is a map for payload codes to struct docs
	Payloads map[DocType]*DocStruct
}

Documentation is the entire documentation for the messages.

func DocumentMessages added in v0.9.8

func DocumentMessages() Documentation

DocumentMessages returns a documentation for the message format.

type KeyboardInteractiveAnswer added in v0.9.7

type KeyboardInteractiveAnswer struct {
	Question string `json:"question" yaml:"question"` // The question text sent to the user.
	Answer   string `json:"answer" yaml:"question"`   // The response from the user.
}

KeyboardInteractiveAnswer is the response from the user to a keyboard-interactive authentication.

func (KeyboardInteractiveAnswer) Equals added in v0.9.7

Equals compares two KeyboardInteractiveAnswer submessages.

type KeyboardInteractiveQuestion added in v0.9.7

type KeyboardInteractiveQuestion struct {
	Question string `json:"question" yaml:"question"` // The question text sent to the user.
	Echo     bool   `json:"echo" yaml:"echo"`         // True if the input was visible on the screen.
}

KeyboardInteractiveQuestion is a description of a question during a keyboard-interactive authentication.

func (KeyboardInteractiveQuestion) Equals added in v0.9.7

Equals compares two KeyboardInteractiveQuestion submessages.

type Message

type Message struct {
	ConnectionID ConnectionID `json:"connectionId" yaml:"connectionId"` // ConnectionID is an opaque ID of the connection.
	Timestamp    int64        `json:"timestamp" yaml:"timestamp"`       // Timestamp is a nanosecond timestamp when the message was created.
	MessageType  Type         `json:"type" yaml:"type"`                 // Type of the Payload object.
	Payload      Payload      `json:"payload" yaml:"payload"`           // Payload is always a pointer to a payload object.
	ChannelID    ChannelID    `json:"channelId" yaml:"channelId"`       // ChannelID is a identifier for an SSH channel, if applicable. -1 otherwise.
}

Message is a basic element of audit logging. It contains the basic records of an interaction.

func (Message) Equals

func (m Message) Equals(other Message) bool

Equals is a method to compare two messages with each other.

type Payload

type Payload interface {
	// Equals compares if the current payload is identical to the provided other payload.
	Equals(payload Payload) bool
}

Payload is an interface that makes sure all payloads with Message have a method to compare them.

type PayloadAuthKeyboardInteractiveAnswer added in v0.9.7

type PayloadAuthKeyboardInteractiveAnswer struct {
	Username string                      `json:"username" yaml:"username"`
	Answers  []KeyboardInteractiveAnswer `json:"answers" yaml:"answers"`
}

PayloadAuthKeyboardInteractiveAnswer is a message that indicates a response to a keyboard-interactive challenge.

func (PayloadAuthKeyboardInteractiveAnswer) Equals added in v0.9.7

Equals compares two PayloadAuthKeyboardInteractiveAnswer messages.

type PayloadAuthKeyboardInteractiveBackendError added in v0.9.7

type PayloadAuthKeyboardInteractiveBackendError struct {
	Username string `json:"username" yaml:"username"`
	Reason   string `json:"reason" yaml:"reason"`
}

PayloadAuthKeyboardInteractiveBackendError indicates an error in the authentication backend during a keyboard-interactive authentication.

func (PayloadAuthKeyboardInteractiveBackendError) Equals added in v0.9.7

Equals compares two PayloadAuthKeyboardInteractiveBackendError payloads.

type PayloadAuthKeyboardInteractiveChallenge added in v0.9.7

type PayloadAuthKeyboardInteractiveChallenge struct {
	Username    string                        `json:"username" yaml:"username"`
	Instruction string                        `json:"instruction" yaml:"instruction"`
	Questions   []KeyboardInteractiveQuestion `json:"questions" yaml:"questions"`
}

PayloadAuthKeyboardInteractiveChallenge is a message that indicates that a keyboard-interactive challenge has been sent to the user. Multiple challenge-response interactions can take place.

func (PayloadAuthKeyboardInteractiveChallenge) Equals added in v0.9.7

Equals compares two PayloadAuthKeyboardInteractiveChallenge messages.

type PayloadAuthKeyboardInteractiveFailed added in v0.9.7

type PayloadAuthKeyboardInteractiveFailed struct {
	Username string
}

PayloadAuthKeyboardInteractiveFailed indicates that a keyboard-interactive authentication process has failed.

func (PayloadAuthKeyboardInteractiveFailed) Equals added in v0.9.7

Equals compares two PayloadAuthKeyboardInteractiveFailed payloads.

type PayloadAuthPassword

type PayloadAuthPassword struct {
	Username string `json:"username" yaml:"username"`
	Password []byte `json:"password" yaml:"password"`
}

PayloadAuthPassword is a payload for a message that indicates an authentication attempt, successful, or failed

authentication.

func (PayloadAuthPassword) Equals

func (p PayloadAuthPassword) Equals(other Payload) bool

Equals compares two PayloadAuthPassword payloads.

type PayloadAuthPasswordBackendError

type PayloadAuthPasswordBackendError struct {
	Username string `json:"username" yaml:"username"`
	Password []byte `json:"password" yaml:"password"`
	Reason   string `json:"reason" yaml:"reason"`
}

PayloadAuthPasswordBackendError is a payload for a message that indicates a backend failure during authentication.

func (PayloadAuthPasswordBackendError) Equals

Equals compares two PayloadAuthPasswordBackendError payloads.

type PayloadAuthPubKey

type PayloadAuthPubKey struct {
	Username string `json:"username" yaml:"username"`
	Key      string `json:"key" yaml:"key"`
}

PayloadAuthPubKey is a payload for a public key based authentication

func (PayloadAuthPubKey) Equals

func (p PayloadAuthPubKey) Equals(other Payload) bool

Equals compares two PayloadAuthPubKey payloads

type PayloadAuthPubKeyBackendError

type PayloadAuthPubKeyBackendError struct {
	Username string `json:"username" yaml:"username"`
	Key      string `json:"key" yaml:"key"`
	Reason   string `json:"reason" yaml:"reason"`
}

PayloadAuthPubKeyBackendError is a payload for a message indicating that there was a backend error while

authenticating with public key.

func (PayloadAuthPubKeyBackendError) Equals

func (p PayloadAuthPubKeyBackendError) Equals(other Payload) bool

Equals compares two PayloadAuthPubKeyBackendError payloads

type PayloadChannelRequestDecodeFailed

type PayloadChannelRequestDecodeFailed struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	RequestType string `json:"requestType" yaml:"requestType"`
	Payload     []byte `json:"payload" yaml:"payload"`
	Reason      string `json:"reason" yaml:"reason"`
}

PayloadChannelRequestDecodeFailed is a payload that signals a supported request that the server was unable to decode.

func (PayloadChannelRequestDecodeFailed) Equals

Equals compares two PayloadChannelRequestDecodeFailed payloads.

type PayloadChannelRequestExec

type PayloadChannelRequestExec struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	Program string `json:"program" yaml:"program"`
}

PayloadChannelRequestExec is a payload signaling the request to execute a program.

func (PayloadChannelRequestExec) Equals

func (p PayloadChannelRequestExec) Equals(other Payload) bool

Equals compares two PayloadChannelRequestExec payloads.

type PayloadChannelRequestPty

type PayloadChannelRequestPty struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	Term     string `json:"term" yaml:"term"`
	Columns  uint32 `json:"columns" yaml:"columns"`
	Rows     uint32 `json:"rows" yaml:"rows"`
	Width    uint32 `json:"width" yaml:"width"`
	Height   uint32 `json:"height" yaml:"height"`
	ModeList []byte `json:"modelist" yaml:"modelist"`
}

PayloadChannelRequestPty is a payload signaling the request for an interactive terminal.

func (PayloadChannelRequestPty) Equals

func (p PayloadChannelRequestPty) Equals(other Payload) bool

Equals compares two PayloadChannelRequestPty payloads.

type PayloadChannelRequestSetEnv

type PayloadChannelRequestSetEnv struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	Name  string `json:"name" yaml:"name"`
	Value string `json:"value" yaml:"value"`
}

PayloadChannelRequestSetEnv is a payload signaling the request for an environment variable.

func (PayloadChannelRequestSetEnv) Equals

func (p PayloadChannelRequestSetEnv) Equals(other Payload) bool

Equals compares two PayloadChannelRequestSetEnv payloads.

type PayloadChannelRequestShell

type PayloadChannelRequestShell struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`
}

PayloadChannelRequestShell is a payload signaling a request for a shell.

func (PayloadChannelRequestShell) Equals

func (p PayloadChannelRequestShell) Equals(other Payload) bool

Equals compares two PayloadChannelRequestShell payloads.

type PayloadChannelRequestSignal

type PayloadChannelRequestSignal struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	Signal string `json:"signal" yaml:"signal"`
}

PayloadChannelRequestSignal is a payload signaling a signal request to be sent to the currently running program.

func (PayloadChannelRequestSignal) Equals

func (p PayloadChannelRequestSignal) Equals(other Payload) bool

Equals compares two PayloadChannelRequestSignal payloads.

type PayloadChannelRequestSubsystem

type PayloadChannelRequestSubsystem struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	Subsystem string `json:"subsystem" yaml:"subsystem"`
}

PayloadChannelRequestSubsystem is a payload requesting a well-known subsystem (e.g. sftp)

func (PayloadChannelRequestSubsystem) Equals

Equals compares two PayloadChannelRequestSubsystem payloads.

type PayloadChannelRequestUnknownType

type PayloadChannelRequestUnknownType struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`

	RequestType string `json:"requestType" yaml:"requestType"`
	Payload     []byte `json:"payload" yaml:"payload"`
}

PayloadChannelRequestUnknownType is a payload signaling that a channel request was not supported.

func (PayloadChannelRequestUnknownType) Equals

Equals compares two PayloadChannelRequestUnknownType payloads.

type PayloadChannelRequestWindow

type PayloadChannelRequestWindow struct {
	RequestID uint64 `json:"requestId" yaml:"requestId"`
	Columns   uint32 `json:"columns" yaml:"columns"`
	Rows      uint32 `json:"rows" yaml:"rows"`
	Width     uint32 `json:"width" yaml:"width"`
	Height    uint32 `json:"height" yaml:"height"`
}

PayloadChannelRequestWindow is a payload requesting the change in the terminal window size.

func (PayloadChannelRequestWindow) Equals

func (p PayloadChannelRequestWindow) Equals(other Payload) bool

Equals compares two PayloadChannelRequestWindow payloads.

type PayloadConnect

type PayloadConnect struct {
	RemoteAddr string `json:"remoteAddr" yaml:"remoteAddr"` // RemoteAddr contains the IP address of the connecting user.
	Country    string `json:"country" yaml:"country"`       // Country contains the country code looked up from the IP address. Contains "XX" if the lookup failed.
}

PayloadConnect is the payload for TypeConnect messages.

func (PayloadConnect) Equals

func (p PayloadConnect) Equals(other Payload) bool

Equals compares two PayloadConnect datasets.

type PayloadExit added in v0.9.1

type PayloadExit struct {
	ExitStatus uint32 `json:"exitStatus" yaml:"exitStatus"`
}

PayloadExit is the payload for a message that is sent when a program exits.

func (PayloadExit) Equals added in v0.9.1

func (p PayloadExit) Equals(other Payload) bool

Equals compares two PayloadExit payloads.

type PayloadExitSignal added in v0.9.7

type PayloadExitSignal struct {
	Signal       string `json:"signal" yaml:"signal"`
	CoreDumped   bool   `json:"coreDumped" yaml:"coreDumped"`
	ErrorMessage string `json:"errorMessage" yaml:"errorMessage"`
	LanguageTag  string `json:"languageTag" yaml:"languageTag"`
}

PayloadExitSignal indicates the signal that caused a program to abort.

func (PayloadExitSignal) Equals added in v0.9.7

func (p PayloadExitSignal) Equals(other Payload) bool

Equals compares two PayloadExitSignal payloads.

type PayloadGlobalRequestUnknown

type PayloadGlobalRequestUnknown struct {
	RequestType string `json:"requestType" yaml:"requestType"`
}

PayloadGlobalRequestUnknown Is a payload for the TypeGlobalRequestUnknown messages.

func (PayloadGlobalRequestUnknown) Equals

func (p PayloadGlobalRequestUnknown) Equals(other Payload) bool

Equals Compares two PayloadGlobalRequestUnknown payloads.

type PayloadHandshakeFailed added in v0.9.2

type PayloadHandshakeFailed struct {
	Reason string `json:"reason" yaml:"reason"`
}

PayloadHandshakeFailed is a payload for a failed handshake.

func (PayloadHandshakeFailed) Equals added in v0.9.2

func (p PayloadHandshakeFailed) Equals(other Payload) bool

Equals compares two PayloadHandshakeFailed payloads.

type PayloadHandshakeSuccessful added in v0.9.2

type PayloadHandshakeSuccessful struct {
	Username string `json:"username" yaml:"username"`
}

PayloadAuthPubKey is a payload for a successful handshake.

func (PayloadHandshakeSuccessful) Equals added in v0.9.2

func (p PayloadHandshakeSuccessful) Equals(other Payload) bool

Equals compares two PayloadHandshakeSuccessful payloads

type PayloadIO

type PayloadIO struct {
	Stream Stream `json:"stream" yaml:"stream"` // 0 = stdin, 1 = stdout, 2 = stderr
	Data   []byte `json:"data" yaml:"data"`
}

PayloadIO The payload for I/O message types containing the data stream from/to the application.

func (PayloadIO) Equals

func (p PayloadIO) Equals(other Payload) bool

Equals Compares two PayloadIO objects

type PayloadNewChannel

type PayloadNewChannel struct {
	ChannelType string `json:"channelType" yaml:"channelType"`
}

PayloadNewChannel is a payload that signals a request for a new SSH channel

func (PayloadNewChannel) Equals

func (p PayloadNewChannel) Equals(other Payload) bool

Equals compares two PayloadNewChannel payloads.

type PayloadNewChannelFailed

type PayloadNewChannelFailed struct {
	ChannelType string `json:"channelType" yaml:"channelType"`
	Reason      string `json:"reason" yaml:"reason"`
}

PayloadNewChannelFailed is a payload that signals that a request for a new channel has failed.

func (PayloadNewChannelFailed) Equals

func (p PayloadNewChannelFailed) Equals(other Payload) bool

Equals compares two PayloadNewChannelFailed payloads.

type PayloadNewChannelSuccessful

type PayloadNewChannelSuccessful struct {
	ChannelType string `json:"channelType" yaml:"channelType"`
}

PayloadNewChannelSuccessful is a payload that signals that a channel request was successful.

func (PayloadNewChannelSuccessful) Equals

func (p PayloadNewChannelSuccessful) Equals(other Payload) bool

Equals compares two PayloadNewChannelSuccessful payloads.

type PayloadRequestFailed added in v0.9.1

type PayloadRequestFailed struct {
	RequestID uint64 `json:"requestId" yaml:"reason"`
	Reason    string `json:"reason" yaml:"reason"`
}

PayloadRequestFailed is the payload for the TypeRequestFailed messages.

func (PayloadRequestFailed) Equals added in v0.9.1

func (p PayloadRequestFailed) Equals(other Payload) bool

Equals compares two PayloadRequestFailed datasets.

type Stream

type Stream uint

Stream The stream type corresponds to the file descriptor numbers common in UNIX systems for standard input, output,

and error.
const (
	// StreamStdin Is the ID of the standard input that accepts data from the user.
	StreamStdin Stream = 0
	// StreamStdout Is the ID for the output stream containing normal messages or TTY-encoded data from the application.
	StreamStdout Stream = 1
	// StreamStderr Is the ID for the standard error containing the error messages for the application in non-TTY mode.
	StreamStderr Stream = 2
)

type Type

type Type int32

Type is the ID for the message type describing which payload is in the payload field of the message.

const (
	TypeConnect                  Type = 0   // TypeConnect describes a message that is sent when the user connects on a TCP level.
	TypeDisconnect               Type = 1   // TypeDisconnect describes a message that is sent when the user disconnects on a TCP level.
	TypeAuthPassword             Type = 100 // TypeAuthPassword describes a message that is sent when the user submits a username and password.
	TypeAuthPasswordSuccessful   Type = 101 // TypeAuthPasswordSuccessful describes a message that is sent when the submitted username and password were valid.
	TypeAuthPasswordFailed       Type = 102 // TypeAuthPasswordFailed describes a message that is sent when the submitted username and password were invalid.
	TypeAuthPasswordBackendError Type = 103 // TypeAuthPasswordBackendError describes a message that is sent when the auth server failed to respond to a request with username and password
	TypeAuthPubKey               Type = 104 // TypeAuthPubKey describes a message that is sent when the user submits a username and public key.
	TypeAuthPubKeySuccessful     Type = 105 // TypeAuthPubKeySuccessful describes a message that is sent when the submitted username and public key were invalid.
	TypeAuthPubKeyFailed         Type = 106 // TypeAuthPubKeyFailed describes a message that is sent when the submitted username and public key were invalid.
	TypeAuthPubKeyBackendError   Type = 107 // TypeAuthPubKeyBackendError describes a message that is sent when the auth server failed to respond with username and password.

	TypeAuthKeyboardInteractiveChallenge    Type = 108 // TypeAuthKeyboardInteractiveChallenge is a message that indicates that a keyboard-interactive challenge has been sent to the user. Multiple challenge-response interactions can take place.
	TypeAuthKeyboardInteractiveAnswer       Type = 109 // TypeAuthKeyboardInteractiveAnswer is a message that indicates a response to a keyboard-interactive challenge.
	TypeAuthKeyboardInteractiveFailed       Type = 110 // TypeAuthKeyboardInteractiveFailed indicates that a keyboard-interactive authentication process has failed.
	TypeAuthKeyboardInteractiveBackendError Type = 111 // TypeAuthKeyboardInteractiveBackendError indicates an error in the authentication backend during a keyboard-interactive authentication.

	TypeHandshakeFailed      Type = 198 // TypeHandshakeFailed indicates that the handshake has failed.
	TypeHandshakeSuccessful  Type = 199 // TypeHandshakeSuccessful indicates that the handshake and authentication was successful.
	TypeGlobalRequestUnknown Type = 200 // TypeGlobalRequestUnknown describes a message when a global (non-channel) request was sent that was not recognized.

	TypeNewChannel           Type = 300 // TypeNewChannel describes a message that indicates a new channel request.
	TypeNewChannelSuccessful Type = 301 // TypeNewChannelSuccessful describes a message when the new channel request was successful.
	TypeNewChannelFailed     Type = 302 // TypeNewChannelFailed describes a message when the channel request failed for the reason indicated.

	TypeChannelRequestUnknownType  Type = 400 // TypeChannelRequestUnknownType describes an in-channel request from the user that is not supported.
	TypeChannelRequestDecodeFailed Type = 401 // TypeChannelRequestDecodeFailed describes an in-channel request from the user that is supported but the payload could not be decoded.
	TypeChannelRequestSetEnv       Type = 402 // TypeChannelRequestSetEnv describes an in-channel request to set an environment variable.
	TypeChannelRequestExec         Type = 403 // TypeChannelRequestExec describes an in-channel request to run a program.
	TypeChannelRequestPty          Type = 404 // TypeChannelRequestPty describes an in-channel request to create an interactive terminal

	TypeChannelRequestShell  Type = 405 // TypeChannelRequestShell describes an in-channel request to start a shell.
	TypeChannelRequestSignal Type = 406 // TypeChannelRequestSignal describes an in-channel request to send a signal to the currently running program.

	TypeChannelRequestSubsystem Type = 407 // TypeChannelRequestSubsystem describes an in-channel request to start a well-known subsystem (e.g. SFTP).
	TypeChannelRequestWindow    Type = 408 // TypeChannelRequestWindow describes an in-channel request to resize the current interactive terminal.

	TypeWriteClose Type = 496 // TypeWriteClose indicates that the channel was closed for writing from the server side.
	TypeClose      Type = 497 // TypeClose indicates that the channel was closed.
	TypeExitSignal Type = 498 // TypeExitSignal describes the signal that caused a program to terminate abnormally.
	TypeExit       Type = 499 // TypeExit describes a message that is sent when the program exited. The payload contains the exit status.

	TypeIO            Type = 500 // TypeIO describes the data transferred to and from the currently running program on the terminal.
	TypeRequestFailed Type = 501 // TypeRequestFailed describes that a request has failed.
)

func ListTypes added in v0.9.8

func ListTypes() []Type

ListTypes returns all defined types.

func (Type) Code added in v0.9.8

func (messageType Type) Code() int32

Code returns a numeric code for this message type.

func (Type) ID added in v0.9.8

func (messageType Type) ID() string

ID converts the numeric message type to a string representation for human consumption.

func (Type) Name added in v0.9.8

func (messageType Type) Name() string

ID converts the numeric message type to a string representation for human consumption.

func (Type) Payload added in v0.9.8

func (messageType Type) Payload() (Payload, error)

Payload returns a typed struct for a payload. May be nil if the payload is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL