filetransfer

package
v0.0.0-...-92d1176 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 1 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// MessageTypeGet requests a file from the device.
	MessageTypeGet = "get_file"
	// MessageTypePut requests a file upload to the device. The body MUST
	// contain a FileInfo object.
	MessageTypePut = "put_file"
	// MessageTypeACK messages MUST be sent in response to a
	// file_chunk or put_file message.
	MessageTypeACK = "ack"
	// MessageTypeStat requests file information from the device. The body
	// MUST contain a StatFile object.
	MessageTypeStat = "stat"
	// MessageTypeFileInfo is a response to a MessageTypeStat request.
	// The body MUST contain a FileInfo object.
	MessageTypeFileInfo = "file_info"
	// MessageTypeChunk is the message type for streaming file chunks. The
	// body contains a binary slice of the file, and optional "offset" property
	// can be passed in the header.
	MessageTypeChunk = "file_chunk"
	// MessageTypeError is returned on internal or protocol errors. The
	// body MUST contain an Error object.
	MessageTypeError = "error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// The error description, as in "Permission denied while opening a file"
	Error *string `msgpack:"err" json:"error"`
	// Type of message that raised the error
	MessageType *string `msgpack:"msgtype,omitempty" json:"message_type,omitempty"`
	// Message id is passed in the MsgProto Properties, and in case it is available and
	// error occurs it is passed for reference in the Body of the error message
	MessageID *string `msgpack:"msgid,omitempty" json:"message_id,omitempty"`
}

The Error struct is passed in the Body of MsgProto in case the message type is ErrorMessage

type FileInfo

type FileInfo struct {
	// The file path to the file we are sending status for
	Path *string `msgpack:"path" json:"path"`
	// The file size
	Size *int64 `msgpack:"size,omitempty" json:"size,omitempty"`
	// The file owner
	UID *uint32 `msgpack:"uid,omitempty" json:"uid,omitempty"`
	// The file group
	GID *uint32 `msgpack:"gid,omitempty" json:"gid,omitempty"`
	// Mode contains the file mode and permission bits.
	Mode *uint32 `msgpack:"mode,omitempty" json:"mode,omitempty"`
	// ModTime is the last modification time for the file.
	ModTime *time.Time `msgpack:"modtime,omitempty" json:"modification_time,omitempty"`
}

FileInfo is the object returned from a StatFile request and is also used for "put_file" requests for specifying the target file.

type GetFile

type GetFile struct {
	// The file path to the file we are requesting
	Path *string `msgpack:"path,omitempty" json:"path,omitempty"`
}

Get file requests the flow of MessageTypeFileChunk messages to be started from the remote end

type StatFile

type StatFile struct {
	// The file path to the file we are requesting
	Path *string `msgpack:"path" json:"path,omitempty"`
}

Stat file requests the file stat structure from the remote end

type UploadRequest

type UploadRequest struct {
	// SrcPath is the (optional) source filename which will be appended
	// to the target path if it points to a directory.
	SrcPath *string `msgpack:"src_path,omitempty" json:"src_path,omitempty"`
	// The file path to the file we are sending status for
	Path *string `msgpack:"path" json:"path"`
	// The file size
	Size *int64 `msgpack:"size,omitempty" json:"size,omitempty"`
	// The file owner
	UID *uint32 `msgpack:"uid,omitempty" json:"uid,omitempty"`
	// The file group
	GID *uint32 `msgpack:"gid,omitempty" json:"gid,omitempty"`
	// Mode contains the file mode and permission bits.
	Mode *uint32 `msgpack:"mode,omitempty" json:"mode,omitempty"`
	// ModTime is the last modification time for the file.
	ModTime *time.Time `msgpack:"modtime,omitempty" json:"modification_time,omitempty"`
}

Jump to

Keyboard shortcuts

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