Documentation ¶
Index ¶
- type Wrapper
- func (w *Wrapper) CloseSend(tid *ftCrypto.TransferID) error
- func (w *Wrapper) MaxFileNameLen() int
- func (w *Wrapper) MaxFileSize() int
- func (w *Wrapper) MaxFileTypeLen() int
- func (w *Wrapper) MaxPreviewSize() int
- func (w *Wrapper) Receive(tid *ftCrypto.TransferID) ([]byte, error)
- func (w *Wrapper) RegisterReceivedProgressCallback(tid *ftCrypto.TransferID, progressCB ft.ReceivedProgressCallback, ...) error
- func (w *Wrapper) RegisterSentProgressCallback(tid *ftCrypto.TransferID, progressCB ft.SentProgressCallback, ...) error
- func (w *Wrapper) Send(groupID *id.ID, fileName, fileType string, fileData []byte, retry float32, ...) (*ftCrypto.TransferID, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
Wrapper handles the sending and receiving of file transfers for group chats.
func NewWrapper ¶
func NewWrapper(receiveCB ft.ReceiveCallback, ft ft.FileTransfer, gc gcManager) (*Wrapper, error)
NewWrapper generates a new file transfer Wrapper for group chat.
func (*Wrapper) CloseSend ¶
func (w *Wrapper) CloseSend(tid *ftCrypto.TransferID) error
CloseSend deletes a file from the internal storage once a transfer has completed or reached the retry limit. Returns an error if the transfer has not run out of retries.
This function should be called once a transfer completes or errors out (as reported by the progress callback).
func (*Wrapper) MaxFileNameLen ¶
MaxFileNameLen returns the max number of bytes allowed for a file name.
func (*Wrapper) MaxFileSize ¶
MaxFileSize returns the max number of bytes allowed for a file.
func (*Wrapper) MaxFileTypeLen ¶
MaxFileTypeLen returns the max number of bytes allowed for a file type.
func (*Wrapper) MaxPreviewSize ¶
MaxPreviewSize returns the max number of bytes allowed for a file preview.
func (*Wrapper) Receive ¶
func (w *Wrapper) Receive(tid *ftCrypto.TransferID) ([]byte, error)
Receive returns the full file on the completion of the transfer. It deletes internal references to the data and unregisters any attached progress callback. Returns an error if the transfer is not complete, the full file cannot be verified, or if the transfer cannot be found.
Receive can only be called once the progress callback returns that the file transfer is complete.
func (*Wrapper) RegisterReceivedProgressCallback ¶
func (w *Wrapper) RegisterReceivedProgressCallback(tid *ftCrypto.TransferID, progressCB ft.ReceivedProgressCallback, period time.Duration) error
RegisterReceivedProgressCallback allows for the registration of a callback to track the progress of an individual received file transfer. This must be done when a new transfer is received on the ReceiveCallback.
func (*Wrapper) RegisterSentProgressCallback ¶
func (w *Wrapper) RegisterSentProgressCallback(tid *ftCrypto.TransferID, progressCB ft.SentProgressCallback, period time.Duration) error
RegisterSentProgressCallback allows for the registration of a callback to track the progress of an individual sent file transfer.
func (*Wrapper) Send ¶
func (w *Wrapper) Send(groupID *id.ID, fileName, fileType string, fileData []byte, retry float32, preview []byte, progressCB ft.SentProgressCallback, period time.Duration) ( *ftCrypto.TransferID, error)
Send initiates the sending of a file to a group and returns a transfer ID that uniquely identifies this file transfer.