server

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	sync.Cond
	sync.RWMutex
	sync.Once
	// contains filtered or unexported fields
}

File server representation of a file

func (*File) GenerateRPCFile

func (f *File) GenerateRPCFile() (*net.RPCFile, error)

GenerateRPCFile returns common RPC representation of a server file

func (*File) MarshalText

func (f *File) MarshalText() (text []byte, err error)

MarshalText converts the clientFile representation to a utf encoded byte array

func (*File) UnmarshalText

func (f *File) UnmarshalText(text []byte) error

UnmarshalText takes a utf encoded byte array and builds a ClientFile object from it

type TorrxferServer

type TorrxferServer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

TorrxferServer server struct

func RunServer

func RunServer(serverConf common.ServerConfig, enableTLS bool, cafilePath, keyfilePath string) *TorrxferServer

RunServer starts the server

func (*TorrxferServer) Close

func (s *TorrxferServer) Close(clientID string)

Close closes the active file for the clientID

func (*TorrxferServer) QueryFunction

func (s *TorrxferServer) QueryFunction(clientID string, file *net.RPCFile) (*net.RPCFile, error)

QueryFunction implementation for gRPC call query file. Returns current file information and sets the file as a target for that connection clientID

func (*TorrxferServer) RegisterForWriteNotification

func (s *TorrxferServer) RegisterForWriteNotification(clientID string) (chan error, chan struct{})

RegisterForWriteNotification returns the notification channel for the clientID

func (*TorrxferServer) TransferFunction

func (s *TorrxferServer) TransferFunction(clientID string, fileBytes []byte, blockSize uint32, currentOffset uint64) error

TransferFunction gRPC TransferFile implementation. Writes the file bytes at the specified offset to the currently active file for the clientID

Jump to

Keyboard shortcuts

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