Documentation ¶
Index ¶
- type FileTransferControl
- func (ctl *FileTransferControl) Cancel()
- func (ctl *FileTransferControl) CloseAll()
- func (ctl *FileTransferControl) ReportDeclined()
- func (ctl *FileTransferControl) ReportError(e error)
- func (ctl *FileTransferControl) ReportErrorNonblocking(e error)
- func (ctl *FileTransferControl) ReportFinished()
- func (ctl *FileTransferControl) SendUpdate(current, total int64)
- func (ctl *FileTransferControl) WaitForCancel(k func())
- func (ctl *FileTransferControl) WaitForError(k func(error))
- func (ctl *FileTransferControl) WaitForFinish(k func(bool))
- func (ctl *FileTransferControl) WaitForUpdate(k func(int64, int64))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileTransferControl ¶
type FileTransferControl struct { sync.RWMutex // all updates to the channels need to be protected by this mutex OnEncryptionNotSupported func() bool // called if encryption is not supported - the return value is true if we should continue without encryption EncryptionDecision func(bool) // called when we have decided to use encryption or not // contains filtered or unexported fields }
FileTransferControl supplies the capabilities to control the file transfer
func CreateFileTransferControl ¶
func CreateFileTransferControl(onNoEnc func() bool, encDecision func(bool)) *FileTransferControl
CreateFileTransferControl will return a new control object for file transfers
func (*FileTransferControl) Cancel ¶
func (ctl *FileTransferControl) Cancel()
Cancel will cancel the file transfer
func (*FileTransferControl) CloseAll ¶
func (ctl *FileTransferControl) CloseAll()
CloseAll closes all channels
func (*FileTransferControl) ReportDeclined ¶
func (ctl *FileTransferControl) ReportDeclined()
ReportDeclined will be called if the file transfer is declined
func (*FileTransferControl) ReportError ¶
func (ctl *FileTransferControl) ReportError(e error)
ReportError will report an error
func (*FileTransferControl) ReportErrorNonblocking ¶
func (ctl *FileTransferControl) ReportErrorNonblocking(e error)
ReportErrorNonblocking will report an error to the file transfer in a non-blocking manner
func (*FileTransferControl) ReportFinished ¶
func (ctl *FileTransferControl) ReportFinished()
ReportFinished will be called when the file transfer is finished
func (*FileTransferControl) SendUpdate ¶
func (ctl *FileTransferControl) SendUpdate(current, total int64)
SendUpdate sends update information
func (*FileTransferControl) WaitForCancel ¶
func (ctl *FileTransferControl) WaitForCancel(k func())
WaitForCancel will wait for a cancel event and call the given function when it happens
func (*FileTransferControl) WaitForError ¶
func (ctl *FileTransferControl) WaitForError(k func(error))
WaitForError will wait for an error to occur and then call the function when it happens
func (*FileTransferControl) WaitForFinish ¶
func (ctl *FileTransferControl) WaitForFinish(k func(bool))
WaitForFinish will wait for a transfer to be finished and calls the function after it's done - the argument to the function will be false if the transfer was declined and true if it finished
func (*FileTransferControl) WaitForUpdate ¶
func (ctl *FileTransferControl) WaitForUpdate(k func(int64, int64))
WaitForUpdate will call the function on every update event