ab57afdec2
把桌面 P2P 数据面从 WebView 内 JS WebRTC 移到 Go 进程的 pion,逃离 WebKit/WebView2 写死的 256KB SCTP 接收窗与隐藏窗口的渲染器节流。后端零改动、与现有客户端互通(线协议逐字节对齐)。真机实测原生↔原生 / 原生↔iOS(经有线)稳定 7-10MB/s,对比旧 JS 路径的 1.5MB/s 还塌缩是质变。设计与阶段见 desktop/NATIVE-TRANSFER.md。
- engine 包(纯 Go,仅 pion+stdlib、零 Wails 依赖,供将来 gomobile 复用于 iOS):pion 收发,逐字节对齐 web 引擎线协议(DataChannel cdrop-file ordered、文本帧 meta/done/ack、二进制分片、信令 {type,sdp?,candidate?});SetSCTPMaxReceiveBufferSize 顶到 4MB;mDNS QueryOnly 解析对端 .local 候选实现同内网 host↔host 直连;接收端直接写盘(去 base64 桥 / OPFS);进程内端到端测试 + 诊断日志(候选/ICE 态/选中对/发送停滞)。
- app.go:Bind P2PStartOutgoing / StartIncoming / HandleSignal / Cancel + 原生取文件 PickFileForSend + 中继回退读盘片 ReadFileSlice;引擎回调经 EventsEmit p2p:* 反向通知(进度/状态/信令/落盘路径/候选对)。
- JS p2pBackend 抽象(p2pNative.ts):桌面按对端把会话委派给 Go 引擎,transfer.ts / hub.ts 零改动;HTTP 全留 JS(出站信令 POST、状态机 /p2p·接收端 /done·/fail);监听 p2p:* 事件驱动 store、phase 与 iceStats。
- 发送取文件改原生路径:selectedFile 模型 File→FileSource(桌面带绝对 path → Go 直接读盘走原生;浏览器拖放无 path → 回退 JS)。Composer dropzone 在桌面打开原生文件对话框。
- 完成语义修复:接收端完成不立即拆连接(续发最终 ack、留 SSE 终态 Cancel 拆、60s 兜底、终态不可被后续 close 翻转)——修「iOS→mac 实际成功却被误标失败」。
- 剪贴板暂存路径修复:富文本经 Universal Clipboard 暂存为 .rtfd,pasteboard 纯文本表示有时取到该暂存路径——uploadClipboard 共享守卫拦截 + mac 原生读改从 RTF / RTFD 派生纯文本。
68 lines
2.6 KiB
Modula-2
68 lines
2.6 KiB
Modula-2
module cdrop-desktop
|
|
|
|
go 1.24.0
|
|
|
|
require (
|
|
fyne.io/systray v1.12.2
|
|
git.sr.ht/~jackmordaunt/go-toast/v2 v2.0.3
|
|
github.com/ebitengine/purego v0.10.1
|
|
github.com/pion/ice/v4 v4.2.7
|
|
github.com/pion/webrtc/v4 v4.2.15
|
|
github.com/wailsapp/wails/v2 v2.12.0
|
|
github.com/zalando/go-keyring v0.2.8
|
|
golang.design/x/clipboard v0.8.0
|
|
golang.org/x/sys v0.41.0
|
|
)
|
|
|
|
require (
|
|
github.com/bep/debounce v1.2.1 // indirect
|
|
github.com/danieljoos/wincred v1.2.3 // indirect
|
|
github.com/go-ole/go-ole v1.3.0 // indirect
|
|
github.com/godbus/dbus/v5 v5.2.2 // indirect
|
|
github.com/google/uuid v1.6.0 // indirect
|
|
github.com/gorilla/websocket v1.5.3 // indirect
|
|
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
|
|
github.com/labstack/echo/v4 v4.13.3 // indirect
|
|
github.com/labstack/gommon v0.4.2 // indirect
|
|
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
|
|
github.com/leaanthony/gosod v1.0.4 // indirect
|
|
github.com/leaanthony/slicer v1.6.0 // indirect
|
|
github.com/leaanthony/u v1.1.1 // indirect
|
|
github.com/mattn/go-colorable v0.1.13 // indirect
|
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
|
github.com/pion/datachannel v1.6.0 // indirect
|
|
github.com/pion/dtls/v3 v3.1.4 // indirect
|
|
github.com/pion/interceptor v0.1.45 // indirect
|
|
github.com/pion/logging v0.2.4 // indirect
|
|
github.com/pion/mdns/v2 v2.1.0 // indirect
|
|
github.com/pion/randutil v0.1.0 // indirect
|
|
github.com/pion/rtcp v1.2.16 // indirect
|
|
github.com/pion/rtp v1.10.2 // indirect
|
|
github.com/pion/sctp v1.10.0 // indirect
|
|
github.com/pion/sdp/v3 v3.0.18 // indirect
|
|
github.com/pion/srtp/v3 v3.0.11 // indirect
|
|
github.com/pion/stun/v3 v3.1.5 // indirect
|
|
github.com/pion/transport/v4 v4.0.2 // indirect
|
|
github.com/pion/turn/v5 v5.0.9 // indirect
|
|
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
|
|
github.com/pkg/errors v0.9.1 // indirect
|
|
github.com/rivo/uniseg v0.4.7 // indirect
|
|
github.com/samber/lo v1.49.1 // indirect
|
|
github.com/tkrajina/go-reflector v0.5.8 // indirect
|
|
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
|
github.com/valyala/fasttemplate v1.2.2 // indirect
|
|
github.com/wailsapp/go-webview2 v1.0.22 // indirect
|
|
github.com/wailsapp/mimetype v1.4.1 // indirect
|
|
github.com/wlynxg/anet v0.0.5 // indirect
|
|
golang.design/x/x11 v0.2.0 // indirect
|
|
golang.org/x/crypto v0.48.0 // indirect
|
|
golang.org/x/exp/shiny v0.0.0-20250606033433-dcc06ee1d476 // indirect
|
|
golang.org/x/image v0.28.0 // indirect
|
|
golang.org/x/mobile v0.0.0-20250606033058-a2a15c67f36f // indirect
|
|
golang.org/x/net v0.50.0 // indirect
|
|
golang.org/x/text v0.34.0 // indirect
|
|
golang.org/x/time v0.14.0 // indirect
|
|
)
|
|
|
|
// replace github.com/wailsapp/wails/v2 v2.12.0 => /Users/commilitia/go/pkg/mod
|