Documentation ¶
Overview ¶
Package tdp implements the Teleport desktop protocol (TDP) encoder/decoder. See https://github.com/gravitational/teleport/blob/master/rfd/0037-desktop-access-protocol.md
Index ¶
- Constants
- func PNGEncoder() *png.Encoder
- type ButtonState
- type ClientScreenSpec
- type ClientUsername
- type ClipboardData
- type Conn
- type Error
- type FileSystemObject
- type KeyboardButton
- type MFA
- type Message
- type MessageType
- type MouseButton
- type MouseButtonType
- type MouseMove
- type MouseWheel
- type MouseWheelAxis
- type PNG2Frame
- type PNGFrame
- type SharedDirectoryAcknowledge
- type SharedDirectoryAnnounce
- type SharedDirectoryCreateRequest
- type SharedDirectoryCreateResponse
- type SharedDirectoryDeleteRequest
- type SharedDirectoryDeleteResponse
- type SharedDirectoryInfoRequest
- type SharedDirectoryInfoResponse
- type SharedDirectoryListRequest
- type SharedDirectoryListResponse
- type SharedDirectoryMoveRequest
- type SharedDirectoryMoveResponse
- type SharedDirectoryReadRequest
- type SharedDirectoryReadResponse
- type SharedDirectoryWriteRequest
- type SharedDirectoryWriteResponse
Constants ¶
const ( TypeClientScreenSpec = MessageType(1) TypePNGFrame = MessageType(2) TypeMouseMove = MessageType(3) TypeMouseButton = MessageType(4) TypeKeyboardButton = MessageType(5) TypeClipboardData = MessageType(6) TypeClientUsername = MessageType(7) TypeMouseWheel = MessageType(8) TypeError = MessageType(9) TypeMFA = MessageType(10) TypePNG2Frame = MessageType(27) )
For descriptions of each message type see: https://github.com/gravitational/teleport/blob/master/rfd/0037-desktop-access-protocol.md#message-types
const ( LeftMouseButton = MouseButtonType(0) MiddleMouseButton = MouseButtonType(1) RightMouseButton = MouseButtonType(2) )
const ( ButtonNotPressed = ButtonState(0) ButtonPressed = ButtonState(1) )
const ( VerticalWheelAxis = MouseWheelAxis(0) HorizontalWheelAxis = MouseWheelAxis(1) )
Variables ¶
This section is empty.
Functions ¶
func PNGEncoder ¶
PNGEncoder returns the encoder used for PNG Frames. It is not safe for concurrent use.
Types ¶
type ButtonState ¶
type ButtonState byte
ButtonState is the press state of a keyboard or mouse button.
type ClientScreenSpec ¶
ClientScreenSpec is the client screen specification. https://github.com/gravitational/teleport/blob/master/rfd/0037-desktop-access-protocol.md#1---client-screen-spec
func (ClientScreenSpec) Encode ¶
func (s ClientScreenSpec) Encode() ([]byte, error)
type ClientUsername ¶
type ClientUsername struct {
Username string
}
ClientUsername is the client username. https://github.com/gravitational/teleport/blob/master/rfd/0037-desktop-access-protocol.md#7---client-username
func (ClientUsername) Encode ¶
func (r ClientUsername) Encode() ([]byte, error)
type ClipboardData ¶
type ClipboardData []byte
ClipboardData represents shared clipboard data.
func (ClipboardData) Encode ¶
func (c ClipboardData) Encode() ([]byte, error)
type Conn ¶
type Conn struct { // OnSend is an optional callback that is invoked when a TDP message // is sent on the wire. It is passed both the raw bytes and the encoded // message. OnSend func(m Message, b []byte) // OnRecv is an optional callback that is invoked when a TDP message // is received on the wire. OnRecv func(m Message) // contains filtered or unexported fields }
Conn is a desktop protocol connection. It converts between a stream of bytes (io.ReadWriter) and a stream of Teleport Desktop Protocol (TDP) messages.
func NewConn ¶
func NewConn(rw io.ReadWriter) *Conn
NewConn creates a new Conn on top of a ReadWriter, for example a TCP connection. If the provided ReadWriter also implements srv.TrackingConn, then its LocalAddr() and RemoteAddr() will apply to this Conn.
func (*Conn) ReadMessage ¶
ReadMessage reads the next incoming message from the connection.
func (*Conn) WriteMessage ¶
WriteMessage sends a message to the connection.
type FileSystemObject ¶
type FileSystemObject struct { LastModified uint64 Size uint64 FileType uint32 IsEmpty uint8 Path string }
func (FileSystemObject) Encode ¶
func (f FileSystemObject) Encode() ([]byte, error)
type KeyboardButton ¶
type KeyboardButton struct { KeyCode uint32 State ButtonState }
KeyboardButton is the keyboard button press message. https://github.com/gravitational/teleport/blob/master/rfd/0037-desktop-access-protocol.md#4---keyboard-input
func (KeyboardButton) Encode ¶
func (k KeyboardButton) Encode() ([]byte, error)
type MFA ¶
type MFA struct { // Type should be defaults.WebsocketWebauthnChallenge Type byte // MFAAuthenticateChallenge is the challenge we send to the client. // Used for messages from Teleport to the user's browser. *client.MFAAuthenticateChallenge // MFAAuthenticateResponse is the response to the MFA challenge, // sent from the browser to Teleport. *authproto.MFAAuthenticateResponse }
func DecodeMFAChallenge ¶
DecodeMFAChallenge is a helper function used in test purpose to decode MFA challenge payload because in real flow this logic is invoked by a fronted client.
type MouseButton ¶
type MouseButton struct { Button MouseButtonType State ButtonState }
MouseButton is the mouse button press message. https://github.com/gravitational/teleport/blob/master/rfd/0037-desktop-access-protocol.md#4---mouse-button
func (MouseButton) Encode ¶
func (m MouseButton) Encode() ([]byte, error)
type MouseButtonType ¶
type MouseButtonType byte
MouseButtonType identifies a specific button on the mouse.
type MouseMove ¶
type MouseMove struct {
X, Y uint32
}
MouseMove is the mouse movement message. https://github.com/gravitational/teleport/blob/master/rfd/0037-desktop-access-protocol.md#3---mouse-move
type MouseWheel ¶
type MouseWheel struct { Axis MouseWheelAxis Delta int16 }
MouseWheel is the mouse wheel scroll message. https://github.com/gravitational/teleport/blob/master/rfd/0037-desktop-access-protocol.md#8---mouse-wheel
func (MouseWheel) Encode ¶
func (w MouseWheel) Encode() ([]byte, error)
type MouseWheelAxis ¶
type MouseWheelAxis byte
MouseWheelAxis identifies a scroll axis on the mouse wheel.
type PNG2Frame ¶
type PNG2Frame PNGFrame
PNG2Frame is a newer versin of PNGFrame that includes the length of the PNG data.
type PNGFrame ¶
PNGFrame is the PNG frame message https://github.com/gravitational/teleport/blob/master/rfd/0037-desktop-access-protocol.md#2---png-frame
type SharedDirectoryAcknowledge ¶
type SharedDirectoryAcknowledge struct {}
func (SharedDirectoryAcknowledge) Encode ¶
func (s SharedDirectoryAcknowledge) Encode() ([]byte, error)
type SharedDirectoryAnnounce ¶
type SharedDirectoryAnnounce struct {}
func (SharedDirectoryAnnounce) Encode ¶
func (s SharedDirectoryAnnounce) Encode() ([]byte, error)
type SharedDirectoryCreateRequest ¶
type SharedDirectoryCreateRequest struct {}
func (SharedDirectoryCreateRequest) Encode ¶
func (s SharedDirectoryCreateRequest) Encode() ([]byte, error)
type SharedDirectoryCreateResponse ¶
type SharedDirectoryCreateResponse struct {}
func (SharedDirectoryCreateResponse) Encode ¶
func (s SharedDirectoryCreateResponse) Encode() ([]byte, error)
type SharedDirectoryDeleteRequest ¶
type SharedDirectoryDeleteRequest struct {}
func (SharedDirectoryDeleteRequest) Encode ¶
func (s SharedDirectoryDeleteRequest) Encode() ([]byte, error)
type SharedDirectoryDeleteResponse ¶
type SharedDirectoryDeleteResponse struct {}
func (SharedDirectoryDeleteResponse) Encode ¶
func (s SharedDirectoryDeleteResponse) Encode() ([]byte, error)
type SharedDirectoryInfoRequest ¶
type SharedDirectoryInfoRequest struct {}
func (SharedDirectoryInfoRequest) Encode ¶
func (s SharedDirectoryInfoRequest) Encode() ([]byte, error)
type SharedDirectoryInfoResponse ¶
type SharedDirectoryInfoResponse struct {}
func (SharedDirectoryInfoResponse) Encode ¶
func (s SharedDirectoryInfoResponse) Encode() ([]byte, error)
type SharedDirectoryListRequest ¶
type SharedDirectoryListRequest struct {}
func (SharedDirectoryListRequest) Encode ¶
func (s SharedDirectoryListRequest) Encode() ([]byte, error)
type SharedDirectoryListResponse ¶
type SharedDirectoryListResponse struct {}
| message type (26) | completion_id uint32 | err_code uint32 | fso_list_length uint32 | fso_list fso[] |
func (SharedDirectoryListResponse) Encode ¶
func (s SharedDirectoryListResponse) Encode() ([]byte, error)
type SharedDirectoryMoveRequest ¶
type SharedDirectoryMoveRequest struct {}
SharedDirectoryMoveRequest is sent from the TDP server to the client to request a file at original_path be moved to new_path.
func (SharedDirectoryMoveRequest) Encode ¶
func (s SharedDirectoryMoveRequest) Encode() ([]byte, error)
type SharedDirectoryMoveResponse ¶
type SharedDirectoryMoveResponse struct {}
func (SharedDirectoryMoveResponse) Encode ¶
func (s SharedDirectoryMoveResponse) Encode() ([]byte, error)
type SharedDirectoryReadRequest ¶
type SharedDirectoryReadRequest struct {}
SharedDirectoryReadRequest is a message sent by the server to the client to request bytes to be read from the file at the path and starting at byte offset.
func (SharedDirectoryReadRequest) Encode ¶
func (s SharedDirectoryReadRequest) Encode() ([]byte, error)
type SharedDirectoryReadResponse ¶
type SharedDirectoryReadResponse struct {}
SharedDirectoryReadResponse is a message sent by the client to the server in response to the SharedDirectoryReadRequest.
func (SharedDirectoryReadResponse) Encode ¶
func (s SharedDirectoryReadResponse) Encode() ([]byte, error)
type SharedDirectoryWriteRequest ¶
type SharedDirectoryWriteRequest struct {}
SharedDirectoryWriteRequest is a message sent by the server to the client to request bytes to be written the file at the path and starting at byte offset.
func (SharedDirectoryWriteRequest) Encode ¶
func (s SharedDirectoryWriteRequest) Encode() ([]byte, error)
type SharedDirectoryWriteResponse ¶
type SharedDirectoryWriteResponse struct {}
SharedDirectoryWriteResponse is a message sent by the client to the server in response to the SharedDirectoryWriteRequest.
func (SharedDirectoryWriteResponse) Encode ¶
func (s SharedDirectoryWriteResponse) Encode() ([]byte, error)