ncproto

package
v0.0.0-...-29e8fbe Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Hostname         string
	Port             uint16
	WorkingDirectory string
	Threads          uint16
	ConnectionID     uuid.UUID
	ReadBufferSize   uint32
	Quiet            bool
}

Config holds configuration for both sender and receiver

func (*Config) Merge

func (c *Config) Merge(conf Config)

Merge two Config's The calling struct is the resulting struct

type ConnectionClose

type ConnectionClose struct {
	ConnectionID uuid.UUID
}

ConnectionClose closes the connection when sent from client to server

type File

type File struct {
	ID             uuid.UUID
	ConnectionID   uuid.UUID
	FileSize       int64
	Name           string
	RelativePath   []string
	FileDescriptor io.WriteCloser
	ChunkQueue     chan FileChunk
}

File describes a file to be sent/received

func (*File) FullFilePath

func (f *File) FullFilePath(c *Config) string

FullFilePath returns the absolute path of where a file should be located on disk according to a given config

func (*File) GetProgress

func (f *File) GetProgress(count, width int, conf *Config) (string, int)

GetProgress returns the progress of a file transfer as an ascii bar and a number from 0-100

func (*File) PrettySize

func (f *File) PrettySize() string

PrettySize returns a human readable file size

func (*File) RelativeFilePath

func (f *File) RelativeFilePath(c *Config) string

RelativeFilePath gives the path relative to the WorkingDirectory

type FileChunk

type FileChunk struct {
	ID           uuid.UUID
	ConnectionID uuid.UUID
	Data         []byte
	Seq          int
}

FileChunk is the actual file data being sent

type FileComplete

type FileComplete struct {
	ID           uuid.UUID
	ConnectionID uuid.UUID
}

FileComplete is sent when all chunks have been transfered

type INetCopyMessage

type INetCopyMessage interface{}

INetCopyMessage is the interface type that is sent using gob encoding from client to server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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