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>
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package protocol
|
|
|
|
// DeviceType is the kind of device, as shown (with an icon) in peer lists.
|
|
type DeviceType string
|
|
|
|
const (
|
|
DeviceMobile DeviceType = "mobile"
|
|
DeviceDesktop DeviceType = "desktop"
|
|
DeviceWeb DeviceType = "web"
|
|
DeviceHeadless DeviceType = "headless"
|
|
DeviceServer DeviceType = "server"
|
|
)
|
|
|
|
// DeviceInfo is the announcement / handshake payload. It is sent over multicast
|
|
// (with Announce set), returned by GET /info, and exchanged on POST /register.
|
|
//
|
|
// Announce is a pointer so we can distinguish three states on the wire:
|
|
// - nil → field omitted (e.g. /info responses)
|
|
// - true → a discovery probe expecting replies
|
|
// - false → a reply to someone else's probe
|
|
type DeviceInfo struct {
|
|
Alias string `json:"alias"`
|
|
Version string `json:"version"`
|
|
DeviceModel string `json:"deviceModel,omitempty"`
|
|
DeviceType DeviceType `json:"deviceType,omitempty"`
|
|
Fingerprint string `json:"fingerprint"`
|
|
Port int `json:"port"`
|
|
Protocol string `json:"protocol"`
|
|
Download bool `json:"download,omitempty"`
|
|
Announce *bool `json:"announce,omitempty"`
|
|
}
|
|
|
|
// WithAnnounce returns a copy of d with the Announce flag set to v.
|
|
func (d DeviceInfo) WithAnnounce(v bool) DeviceInfo {
|
|
d.Announce = &v
|
|
return d
|
|
}
|