feat: files go in 4 MB pieces, several at once and each retried on its own, so they pass a proxy like Cloudflare and survive a bad link (0.0.8)

This commit is contained in:
redtea committed 2026-10-14 19:06:59 +03:00
1 parent 23e382bf7f
commit e9a845a6ea
8 files changed
+715 -252

No files matched your search

+11 -11
View File
@@ -85,8 +85,8 @@ const (
TaskFSZip = "fs.zip" // zip selected paths (native archive/zip)
TaskFSMove = "fs.move" // move/rename
TaskFSDownload = "fs.download" // read a whole file (larger cap) for browser download
TaskFSUpload = "fs.upload" // write a file from a stream the agent fetches (0.0.7+)
TaskFSGet = "fs.get" // send a file as a stream the agent posts (0.0.7+)
TaskFSPut = "fs.put" // write a file the browser sends in pieces (0.0.8+)
TaskFSSend = "fs.send" // send a file to the browser in pieces (0.0.8+)
TaskSysUpdate = "sys.update" // download the latest agent binary and restart
TaskSysUsers = "sys.users" // report the agent's user and the login-capable users
@@ -99,17 +99,17 @@ const (
// file be edited only when it fits, so that a save never cuts it short.
const FSReadCap = 5 * 1024 * 1024
// FSFileCap bounds a file sent either way as a stream (TaskFSUpload,
// TaskFSGet).
// FSFileCap bounds a file sent either way in pieces (TaskFSPut, TaskFSSend).
const FSFileCap = 512 << 20
// FSStreamArgs are the arguments of TaskFSUpload and TaskFSGet: the file, and
// the stream on the server that carries its bytes (GET it for an upload, POST
// to it for a download). Size is the upload's length, -1 when not known.
type FSStreamArgs struct {
Path string `json:"path"`
Stream string `json:"stream"`
Size int64 `json:"size"`
// FSXferArgs are the arguments of TaskFSPut and TaskFSSend: the file, and the
// transfer on the server whose pieces carry it - GET them for a put, POST them
// for a send, Chunk bytes each. Size is a put's length; -1 for a send.
type FSXferArgs struct {
Path string `json:"path"`
Xfer string `json:"xfer"`
Size int64 `json:"size"`
Chunk int `json:"chunk"`
}
// TaskEnvelope is what the agent fetches for a task id.