mirror of
https://github.com/MatrixSeven/file-transfer-go.git
synced 2026-03-15 21:13:53 +08:00
支持多人加入/下载
This commit is contained in:
@@ -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"`
|
||||
|
||||
Reference in New Issue
Block a user