Skip to main content

Lantern - A P2P file sharing system with TUI dashboard

Project description

Lantern

A peer-to-peer file sharing system with a beautiful terminal UI (TUI) dashboard.

Python Version License

Features

  • P2P File Sharing - Share files directly between computers on the same network
  • Auto Discovery - Automatically discovers peers on the LAN via UDP broadcast
  • Beautiful TUI - Modern terminal interface built with Textual
  • Dual Mode - Both CLI and TUI modes available
  • Light/Dark Themes - Toggle between color schemes
  • Progress Bars - Visual feedback for large file transfers
  • Notifications - Toast notifications for operation completion
  • Path Safety - Built-in protection against path traversal attacks

Installation

From PyPI (when published)

pip install lantern-p2p

From Source

git clone https://github.com/shx-dow/lantern.git
cd lantern
pip install -e .

Usage

TUI Mode (Default)

Launch the terminal dashboard (beautiful visual interface):

lantern

Or explicitly:

lantern --tui

CLI Mode

Use command-line interface (text-based commands):

lantern --cli

Available CLI commands:

  • peers - Show discovered peers
  • list <host[:port]> - List files on remote peer
  • download <host[:port]> <file> - Download a file
  • upload <host[:port]> <path> - Upload a file
  • delete <host[:port]> <file> - Delete remote file
  • myfiles - List your shared files
  • help - Show help
  • quit - Exit

Custom Port

lantern --port 6000

Key Bindings (TUI Mode)

Key Action
F1 Show help
F5 Refresh files
t Toggle theme
u Upload file
d Download file
x Delete file
Tab Cycle focus
q Quit

Configuration

Shared files are stored in the shared_files/ directory by default. This directory is created automatically when you first run Lantern.

Requirements

  • Python 3.8 or higher
  • textual >= 0.50.0
  • psutil >= 5.9.0

Architecture

lantern/
├── config.py      # Configuration constants
├── protocol.py    # Message framing & file transfer protocol
├── discovery.py   # UDP peer discovery
├── server.py      # TCP file server
├── client.py      # TCP client operations
├── peer.py        # CLI entry point
├── tui.py         # Textual TUI dashboard
├── main.py        # Package entry point
└── styles/        # CSS stylesheets
    └── lantern.css

Development

Install with dev dependencies:

pip install -e ".[dev]"

Run linting:

black lantern/
ruff check lantern/

License

MIT License - see LICENSE file for details.

Contributing

Contributions welcome! Please open an issue or pull request.

Acknowledgments

Built with Textual for the TUI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lantern_p2p-1.0.1.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lantern_p2p-1.0.1-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file lantern_p2p-1.0.1.tar.gz.

File metadata

  • Download URL: lantern_p2p-1.0.1.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for lantern_p2p-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8aa9901b0f200544483cb5bd85f7784e19017d844b4704f52b7128593f64ef33
MD5 77e1e4812eac7fc430951930f0f027d2
BLAKE2b-256 c741c55330b585cfbddc538afb62dcc27b76b085ec78dc056f4d04f42e69facd

See more details on using hashes here.

File details

Details for the file lantern_p2p-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: lantern_p2p-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for lantern_p2p-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 09c3723902b69174dd0bee507a96829eb87cb3751ac8c00c0bd2bf32ce4959e1
MD5 f16f27292c9f1145608c18014b0eec31
BLAKE2b-256 de6e46742970717419f7ac5ab7d408d329479d787d68dc780740d600bef14e2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page