feat:统一连接层,精简前后端

This commit is contained in:
MatrixSeven
2025-08-06 18:08:02 +08:00
parent 3f3b7d8f18
commit 7cb0d34fb1
42 changed files with 2790 additions and 9426 deletions

View File

@@ -6,28 +6,6 @@ import (
"github.com/gorilla/websocket"
)
// FileInfo 文件信息结构
type FileInfo struct {
ID string `json:"id"`
FileName string `json:"filename"`
FileSize int64 `json:"file_size"`
ContentType string `json:"content_type"`
Code string `json:"code"`
UploadTime time.Time `json:"upload_time"`
ExpiryTime time.Time `json:"expiry_time"`
DownloadURL string `json:"download_url"`
FilePath string `json:"file_path"`
}
// UploadResponse 上传响应结构
type UploadResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
Code string `json:"code,omitempty"`
FileInfo FileInfo `json:"file_info,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
}
// WebRTCOffer WebRTC offer 结构
type WebRTCOffer struct {
SDP string `json:"sdp"`
@@ -53,15 +31,6 @@ type VideoMessage struct {
Payload interface{} `json:"payload"`
}
// FileTransferInfo P2P文件传输信息
type FileTransferInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Size int64 `json:"size"`
Type string `json:"type"`
LastModified int64 `json:"lastModified"`
}
// ClientInfo 客户端连接信息
type ClientInfo struct {
ID string `json:"id"` // 客户端唯一标识
@@ -73,12 +42,10 @@ type ClientInfo struct {
// 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"`
Code string `json:"code"`
SenderOnline bool `json:"sender_online"`
ReceiverOnline bool `json:"receiver_online"`
CreatedAt time.Time `json:"created_at"`
}
// ErrorResponse 错误响应结构