Skip to content
yifuPublic

About

Airdrop for the terminal. Easily send files from one computer to another, using a TUI.

Topics

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

72 Commits

Folders and files

Repository files navigation

pushpop

Easily send files from one computer to another.

Repository layout (new idiomatic Go structure)

  • cmd/push: push binary that shares a file via TCP + mDNS (zeroconf).
  • cmd/pop: pop binary that discovers an mDNS announcement and downloads the file.
  • pkg/discovery: helpers for mDNS discovery (extracting the user and matching IP).
  • pkg/transfer: transfer logic (accepting connections, sending files, progress bar).

Quick Usage

  1. Build. Both binaries land at the repository root:
./build.sh
# or, by hand:
go build -o push ./cmd/push
go build -o pop ./cmd/pop

Note that go build ./cmd/pop needs the package directory, not cmd/pop/main.go: the command is split across main.go and tui.go.

  1. Send a file from machine A:
./push /path/to/file
  1. On machine B, receive the file (optionally provide the sender's username):
./pop <username>
# without an argument it looks for a file shared by yourself
./pop --force <username>   # overwrite an existing file without asking

Notes

  • The old push/main.go and pop/main.go files have been removed from the repository (their functionalities have been migrated under cmd/).

TODO

  • Be able to push a directory.
  • Be able to resume an interrupted download.
    • Use a .part suffix for partial downloads.
    • Resume only if the server supports HTTP Range requests; otherwise, restart from the beginning and warn the user.
    • Add a --force option to overwrite existing files without confirmation.
    • Do not handle checksums for now (see below).
  • Implement using multiple progress bars (e.g., mpb).
  • (Optional) Implement a mechanism to preallocate the final file size for downloads (file reservation).
  • (Optional) Add checksum/integrity verification after download (BLAKE3).
  • Add IP and username of the user downloading the file (when available) on the push side.
    • Client (pop) now sends the X-PushPop-User header.
    • Server (push) logs start/end of downloads with IP & username, and hash requests.
  • Add a TUI (Terminal User Interface) to manage file sharing:
    • Allow the user to stop sharing a file manually.
    • Display active downloads and connections.
    • Blacklist users based on their IP address or username (when available).
  • Add daemon mode for push:
    • Implement --daemon or -d flag to run push in the background (not default).
    • Create a control socket (e.g., /tmp/pushpop.sock) for daemon management.
    • Implement push --control to attach a TUI to a running daemon.
    • Implement push --stop to gracefully stop a running daemon.
    • Implement push --status to display information about active daemons.
  • Display the user requesting a BLAKE3 in the push output.
  • Fix display of the effective user in push (when pop is run from another machine, push should show the real user, not just the requested name).
    • pop now sends its own local user in X-PushPop-User, instead of the name it was asked to look for.
  • Update push to use Bubble Tea (TUI on the server side).
  • Add a progress bar for downloading the BLAKE3 verification file.
  • Add a progress bar for computing the BLAKE3 checksum (file parsing).
  • It should be possible to bind to a list of interfaces on the push command. And on the pop command?
  • Remove blake package if not used anymore.
  • Pop: Move the Init()/Update()/View() functions into a tui.go file.
  • Pop: adapt the UI to the current window size.
  • Use socket unix when downloading on the same machine.
  • Provide multiple signature files: sha256/Blake3/etc.
  • Better processing when the file exists and/or the part file exists.
  • Use IPV6 addresses eventually.
  • Implement TUI (with altScreen?) in push.
  • Push should be able to provide multiple files in parrallel.
  • Push should launch blake3 signature computation asap.
  • Log should not appear in the standard output when DEBUG env var is undefined.

Known (unresolved) Issues:

  • When you change the current window size, then the title line gets duplicated.
  • Downloading a file through a socket is really slow. (Maybe we should have a longer chunk downloading buffer?)
    • Likely culprit: the .part file is reopened and closed for every 128 KiB chunk, and each chunk makes a full round trip through the Bubble Tea event loop.
  • Sometimes the blake verification progress bar keeps staying a 0%, while the actual processing is progressing.
    • The speed tick stopped rescheduling itself in the done && !verifying window, killing the ticker before the verification started.
  • The BLAKE3 bar lags well behind the byte counter on fast disks: the spring animation cannot keep up with hashing.

About

Airdrop for the terminal. Easily send files from one computer to another, using a TUI.

Topics

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages