-// 00 28 // DataSize
-// 00 00 // IsFolder
-// 00 02 // PathItemCount
-//
-// 00 00
-// 09
-// 73 75 62 66 6f 6c 64 65 72 // "subfolder"
-//
-// 00 00
-// 15
-// 73 75 62 66 6f 6c 64 65 72 2d 74 65 73 74 66 69 6c 65 2d 35 6b // "subfolder-testfile-5k"
-func readFolderUpload(buf []byte) folderUpload {
- dataLen := binary.BigEndian.Uint16(buf[0:2])
-
- fu := folderUpload{
- DataSize: [2]byte{buf[0], buf[1]}, // Size of this structure (not including data size element itself)
- IsFolder: [2]byte{buf[2], buf[3]},
- PathItemCount: [2]byte{buf[4], buf[5]},
- FileNamePath: buf[6 : dataLen+2],
+func (cc *ClientConn) newFileTransfer(transferType int, fileName, filePath, size []byte) *FileTransfer {
+ var transactionRef [4]byte
+ rand.Read(transactionRef[:])
+
+ ft := &FileTransfer{
+ FileName: fileName,
+ FilePath: filePath,
+ ReferenceNumber: transactionRef[:],
+ refNum: transactionRef,
+ Type: transferType,
+ TransferSize: size,
+ ClientConn: cc,
+ bytesSentCounter: &WriteCounter{},