支持多人加入/下载

This commit is contained in:
seven
2025-07-28 18:12:05 +08:00
parent 8031a29037
commit 22cbaae0ab
12 changed files with 2485 additions and 370 deletions

View File

@@ -2,6 +2,8 @@ package models
import (
"time"
"github.com/gorilla/websocket"
)
// FileInfo 文件信息结构
@@ -60,6 +62,25 @@ type FileTransferInfo struct {
LastModified int64 `json:"lastModified"`
}
// ClientInfo 客户端连接信息
type ClientInfo struct {
ID string `json:"id"` // 客户端唯一标识
Role string `json:"role"` // sender 或 receiver
Connection *websocket.Conn `json:"-"` // WebSocket连接不序列化
JoinedAt time.Time `json:"joined_at"` // 加入时间
UserAgent string `json:"user_agent"` // 用户代理
}
// RoomStatus 房间状态信息
type RoomStatus struct {
Code string `json:"code"`
FileCount int `json:"file_count"`
SenderCount int `json:"sender_count"`
ReceiverCount int `json:"receiver_count"`
Clients []ClientInfo `json:"clients"`
CreatedAt time.Time `json:"created_at"`
}
// ErrorResponse 错误响应结构
type ErrorResponse struct {
Success bool `json:"success"`