omarchy-send/internal/transfer/transfer.go
28allday 2dd81700c0 Initial commit: Omarchy-Send v0.1.0
LocalSend-compatible file-transfer TUI for headless Arch/Omarchy servers.

- Pure-stdlib implementation of the LocalSend v2 protocol (discovery,
  HTTPS with matching cert fingerprint, send/receive, PIN).
- Bubble Tea TUI: Devices, Transfers, Manage (received-file housekeeping)
  and Settings, theme-aware on Omarchy.
- Dual-mode install.sh: curl-pipe download or build-from-clone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 19:26:08 +01:00

41 lines
950 B
Go

// Package transfer defines the shared progress-event vocabulary used by both
// the receiver (server) and the sender (client), so the TUI renders incoming
// and outgoing transfers uniformly.
package transfer
import "errors"
// ErrPinRequired is reported by the sender when a peer rejects prepare-upload
// with 401, i.e. it needs a PIN. The TUI prompts for one and retries.
var ErrPinRequired = errors.New("pin required")
// Direction is whether a transfer is incoming (we receive) or outgoing (we send).
type Direction int
const (
Incoming Direction = iota
Outgoing
)
// Kind classifies a transfer lifecycle event.
type Kind int
const (
Start Kind = iota
Progress
FileDone
Error
Cancel
)
// Event reports the progress/lifecycle of one file. A transfer row is keyed by
// ID (sessionId:fileId).
type Event struct {
Dir Direction
Kind Kind
ID string
FileName string
Received int64
Total int64
Err error
}