stream

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PROTOCAL_ID protocol.ID = protocol.ID("/cross-clipboard/0.0.1")

	// data type is the first byte after data size to identify the message type
	DataTypeDevice    DataType = 0xFF // use for device data
	DataTypeClipboard DataType = 0xFE // use for clipboard data

	// signal is the first byte after data size to identify the signal type
	SignalDisconnect        Signal = 0xFD // ending exit signal
	SignalRequestDeviceData Signal = 0xFC // request device data signal
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DataType

type DataType byte

type Signal

type Signal byte

type StreamHandler

type StreamHandler struct {
	// contains filtered or unexported fields
}

StreamHandler struct for stream handler

func NewStreamHandler

func NewStreamHandler(
	cfg *config.Config,
	cp *clipboard.ClipboardManager,
	deviceManager *devicemanager.DeviceManager,
	logChan chan string,
	errorChan chan error,
	pgpDecrypter *crypto.PGPDecrypter,
) *StreamHandler

NewStreamHandler initial new stream handler

func (*StreamHandler) CreateReadData

func (s *StreamHandler) CreateReadData(reader *bufio.Reader, dv *device.Device)

CreateReadData craete a new read streaming for host or peer

func (*StreamHandler) CreateWriteData

func (s *StreamHandler) CreateWriteData()

CreateWriteData handle clipboad channel and write to all peers and host

func (*StreamHandler) HandleStream

func (s *StreamHandler) HandleStream(stream network.Stream)

HandleStream handler when a peer connect this host

func (*StreamHandler) SendSignal

func (s *StreamHandler) SendSignal(dv *device.Device, signal Signal)

SendSignal send signal to device

Jump to

Keyboard shortcuts

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