A lightweight, single-binary web app for sharing files and messages across computers on the same LAN. Built for lab environments where you need quick file transfers and messaging between multiple machines without any setup.
Open a browser on any machine → drop files, send messages, done.
- Slack-style unified feed — chat messages and file uploads appear in the same timeline
- File sharing — upload/download files through the browser, with optional per-file password protection
- Real-time chat — instant messaging via WebSocket, no page refresh needed
- Private transfers — drag a file onto a device name in the sidebar to send it directly (only the recipient sees it)
- Device discovery — automatically shows all connected browsers in a sidebar
- Dark mode — follows system preference
- Zero config — single binary, no database, no accounts, no login
- Embedded UI — all HTML/CSS/JS baked into the binary via
go:embed
# Build
go build -o lanshare.exe .
# Run with defaults (port 8080, files saved to ./shared)
./lanshare.exe
# Or customize
./lanshare.exe --port 3000 --dir /path/to/shared/folderThen open http://<your-lan-ip>:8080 from any machine on the network. The server prints the correct URL on startup.
Type a message in the input box at the bottom and press Enter or click Send.
Click the 📎 button (or drag a file onto the feed area) to attach a file. Optionally check "Set password" to protect it. Click Send. The file appears in the feed for everyone to download.
Drag a file from your desktop onto a device name in the left sidebar. Only that device will see the transfer notification and download link.
When uploading, check "Set password" and enter a password. The file will show a 🔒 icon in the feed. Anyone downloading it must enter the correct password first.
| Flag | Default | Description |
|---|---|---|
--port |
8080 |
HTTP server port |
--dir |
./shared |
Directory to store shared files |
--host |
0.0.0.0 |
Bind address |
main.go Entry point, CLI flags, graceful shutdown
internal/
config/config.go Flag parsing, LAN IP detection
server/server.go HTTP routing
hub/hub.go WebSocket hub — manages connections, chat, device state
handlers/
files.go File upload/download/delete, per-file passwords (bcrypt)
transfer.go Private device-to-device transfers with auto-cleanup
devices.go Online device list endpoint
models/models.go Shared data types
web/
embed.go go:embed directive
index.html Single-page app shell
static/js/ Vanilla JS modules (no build step)
static/css/style.css Dark/light theme via CSS custom properties
Dependencies: Go standard library + github.com/coder/websocket + golang.org/x/crypto/bcrypt
- Each browser that opens the page connects via WebSocket and registers with a nickname (stored in localStorage)
- The hub tracks all connected clients and broadcasts chat messages, file upload notifications, and device join/leave events
- Files are stored on disk in the shared directory; metadata (uploader, password hash) in
.meta.jsonsidecar files - Private transfers are saved to a
.transfers/subdirectory and auto-cleaned after 30 minutes - Chat history (last 200 messages) is kept in memory and sent to new connections
# Install Go (1.22+), then:
git clone <this-repo>
cd LAN_sharing
go build -o lanshare.exe .
./lanshare.exeLeave it running on one machine. Everyone else opens the URL in their browser.
Build on your machine, copy the binary to the target:
# Linux (e.g. lab server)
GOOS=linux GOARCH=amd64 go build -o lanshare .
# macOS
GOOS=darwin GOARCH=amd64 go build -o lanshare .
# Windows
GOOS=windows GOARCH=amd64 go build -o lanshare.exe .No Go installation needed on the target — just copy and run the binary.
Create /etc/systemd/system/lanshare.service:
[Unit]
Description=LANShare file sharing server
After=network.target
[Service]
ExecStart=/opt/lanshare/lanshare --port 8080 --dir /opt/lanshare/shared
WorkingDirectory=/opt/lanshare
Restart=always
User=nobody
[Install]
WantedBy=multi-user.targetThen:
sudo cp lanshare /opt/lanshare/
sudo systemctl enable --now lanshare- Build:
go build -o lanshare.exe . - Press
Win+R, typeshell:startup - Create a shortcut to
lanshare.exe --port 8080in that folder
The server listens on the configured port (default 8080). Make sure your firewall allows inbound TCP connections on that port from your LAN:
# Windows (run as admin)
netsh advfirewall firewall add rule name="LANShare" dir=in action=allow protocol=TCP localport=8080
# Linux
sudo ufw allow 8080/tcp- Go 1.22+ (only needed to build, not to run)
- Any modern browser on the LAN