message

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMessage

func NewMessage(messageType proto.MessageType, payload []byte) *proto.Message

Types

type FileDataPayload

type FileDataPayload struct {
	Data     []byte
	Position int64
	EOF      bool
}

func (*FileDataPayload) Bytes

func (f *FileDataPayload) Bytes(protocol Protocol) ([]byte, error)

type FileInfoPayload

type FileInfoPayload struct {
	FileInfo *files.FileInfo
}

func (*FileInfoPayload) Bytes

func (f *FileInfoPayload) Bytes(protocol Protocol) ([]byte, error)

type FileStatPayload

type FileStatPayload struct {
	FilesSize    int64 `json:"FilesSize,omitempty"`
	FilesNumber  int64 `json:"FilesNumber,omitempty"`
	FolderNumber int64 `json:"FolderNumber,omitempty"`
}

func (*FileStatPayload) Bytes

func (f *FileStatPayload) Bytes(protocol Protocol) ([]byte, error)

type Message

type Message interface {
	Bytes(protocol Protocol) ([]byte, error)
}

Message is the interface of a message to send over the wire

func ParseMessagePayload

func ParseMessagePayload(msg *proto.Message) (Message, error)

type Protocol

type Protocol string

Protocol used to transport messages

const (
	// RawProtocol is raw messages
	RawProtocol Protocol = "raw"
	// JSONProtocol is used for JSON encoded messages
	JSONProtocol Protocol = "json"
)

type ShareCodePayload

type ShareCodePayload struct {
	ShareCode string
}

func (*ShareCodePayload) Bytes

func (c *ShareCodePayload) Bytes(protocol Protocol) ([]byte, error)

Jump to

Keyboard shortcuts

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