general

package
v0.0.51 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CHUNKSIZE int = 1024

amount of bytes each file chunk will contain when uploading or downloading a file.

View Source
const DEFAULTTIMEOUT int = 15

default timeout to use for timeout contexts. defaults to 15 (usually seconds).

Variables

This section is empty.

Functions

func ReceiveByteStrings

func ReceiveByteStrings(receiver ByteReceiver, fptr *os.File) (err error)

function designed to read ByteStrings from a stream and save the data to a file.

func ReceiveFileBytes

func ReceiveFileBytes(receiver Receiver, fptr *os.File) (err error)

function designed to read bytes from a stream and save them to a file.

func TransmitByteStrings

func TransmitByteStrings(transmitter ByteTransmitter, byteReader *bytes.Reader) (err error)

function designed to transmit bytes over the wire using ByteString objects.

func TransmitFileBytes

func TransmitFileBytes(transmitter Transmitter, scanner *bufio.Reader) (err error)

function designed to read a file and transmit its contents to another machine via a Transmitter object. this takes in a pointer to a bufio.Reader object which should already be pointing to a target file.

Types

type ByteReceiver

type ByteReceiver interface {
	Recv() (*common.ByteString, error)
}

a generic object designed to read ByteString data via a Recv function.

type ByteTransmitter

type ByteTransmitter interface {
	Send(*common.ByteString) error
}

a generic object designed to transmit ByteString data via a Send function.

type Receiver

type Receiver interface {
	Recv() (*filehandler.FileChunk, error)
}

a generic object designed to read FileChunk data via a Recv function.

type Transmitter

type Transmitter interface {
	Send(*filehandler.FileChunk) error
}

a generic object designed to transmit FileChunk data via a Send function.

Jump to

Keyboard shortcuts

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