if the file being received already exists locally, it will be renamed

This commit is contained in:
2026-02-07 19:39:14 +08:00
parent e76ada9b4b
commit e76bcd709c
13 changed files with 114 additions and 90 deletions

View File

@@ -34,20 +34,21 @@ const (
// Transfer
type Transfer struct {
ID string `json:"id" binding:"required"` // 传输会话 ID
CreateTime int64 `json:"create_time"` // 创建时间
Sender discovery.Peer `json:"sender" binding:"required"` // 发送者
FileName string `json:"file_name"` // 文件名
FileSize int64 `json:"file_size"` // 文件大小 (字节)
SavePath string `json:"savePath"` // 保存路径
Status TransferStatus `json:"status"` // 传输状态
Progress Progress `json:"progress"` // 传输进度
Type TransferType `json:"type"` // 进度类型
ContentType ContentType `json:"content_type"` // 内容类型
Text string `json:"text"` // 文本内容
ErrorMsg string `json:"error_msg"` // 错误信息
Token string `json:"token"` // 用于上传的凭证
DecisionChan chan Decision `json:"-"` // 用户决策通道
ID string `json:"id" binding:"required"` // 传输会话 ID
CreateTime int64 `json:"create_time"` // 创建时间
Sender discovery.Peer `json:"sender" binding:"required"` // 发送者
// FileName 如果 ContentType 为 file文件名如果 ContentType 为 folder文件夹名如果 ContentType 为 text
FileName string `json:"file_name"` // 文件
FileSize int64 `json:"file_size"` // 文件大小 (字节)
SavePath string `json:"savePath"` // 保存路径
Status TransferStatus `json:"status"` // 传输状态
Progress Progress `json:"progress"` // 传输进度
Type TransferType `json:"type"` // 进度类型
ContentType ContentType `json:"content_type"` // 内容类型
Text string `json:"text"` // 文本内容
ErrorMsg string `json:"error_msg"` // 错误信息
Token string `json:"token"` // 用于上传的凭证
DecisionChan chan Decision `json:"-"` // 用户决策通道
}
type TransferOption func(*Transfer)