English | 中文
A tiny relay + terminal client for chatting, direct messaging and sharing files inside a LAN — with X25519 handshakes, ChaCha20-Poly1305 transport encryption and optional end-to-end encrypted rooms. No OpenSSL, no GTK, no system dependencies: one binary per platform.
Two clients on one relay: E2EE room messages, a 280 KB file transfer with
SHA-256 verification, room switching and pings — rendered from a real recorded
session (docs/images/demo-chat.png, docs/images/demo-server.png).
This project started right after a CTF offline competition (🚄⛰💧☔). The venue had no internet, the schedule was tight, and a team spread across a hall had no sane way to exchange hints, payloads and files: USB sticks, shouting and ad-hoc hotspots. BLANE is the answer we wanted that day — bring up one relay, everyone joins from the terminal, everything on the wire is encrypted.
The first version (v0.1) was a half-working experiment: RSA via OpenSSL, UDP plaintext broadcast, a GTK stub that never compiled, and a protocol that only carried raw strings. v0.2 is a full rewrite — described below.
| Transport security | X25519 ECDH handshake, HKDF-SHA256 key schedule, ChaCha20-Poly1305 AEAD frames, per-direction keys, monotonic nonce counters, replay-safe |
| Rooms | #lobby by default, join/part any room, member list, per-room message history replayed on join |
| End-to-end encryption | --key <passphrase> derives a room key with Argon2id; the relay only ever sees [encrypted] blobs |
| Direct messages | /msg @name text, routed by the relay, works across rooms |
| File transfer | /file <path> with chunked relay, 64 MB cap, SHA-256 verification on both ends, progress output |
| Discovery | UDP broadcast probe (blane-client discover) so you don't have to remember IPs |
| Identity | X25519 keypair persisted locally, short fingerprint (9e48-0857) shown next to every nickname |
| Hardening | nickname/room/filename sanitising, 600 frames/s flood limit, 96 KB frame cap, 8 KB handshake line cap, bounded history |
| Mobile core | blane-mobile exposes a C ABI and a JNI bridge (libblane_mobile.so) ready for an Android app |
| Cross-platform | Linux, Windows and Android builds from one workspace, no C toolchain needed for the crypto |
┌────────────┐ TCP 14514 (AEAD frames) ┌────────────┐
│ blane- │◄───────────────────────────►│ blane- │
│ client │ │ server │
└────────────┘ └────────────┘
▲ ▲ ▲
│ UDP 14515 discovery probe │ │
└──────────────────────────────────────┘ │
│
┌────────────┐ C ABI / JNI │
│ Android │◄─────────────────────────────────────┘
│ (Kotlin) │ libblane_mobile.so
└────────────┘
blane-core— protocol types, crypto, framing, discovery. No OS-specific code.blane-server— the relay: rooms, presence, history, file forwarding, admin console.blane-client— the interactive terminal client (chat,discover,keygen).blane-mobile— the same client core as a shared library for Android.
Details: docs/ARCHITECTURE.md · Wire format: docs/PROTOCOL.md · Build recipes: docs/BUILD.md.
git clone https://github.com/DXHM/BLANE.git
cd BLANE
cargo build --releaseStart a relay (on the machine that will host the LAN party):
./target/release/blane-server --bind 0.0.0.0:14514 --name "BLANE Relay" \
--motd "CTF 现场专用 · 端到端加密房间" --history 50Join from any machine in the same LAN:
./target/release/blane-client --server 192.168.1.10:14514 --name alice --room lobbyWant the room to be end-to-end encrypted? Give everyone the same passphrase:
./target/release/blane-client --server 192.168.1.10:14514 --name alice --key 'flag{lan_party}'The relay's console then shows [chat] #lobby alice: [encrypted] — it cannot read
the message, the passphrase never leaves the clients.
Can't remember the relay IP?
./target/release/blane-client discover --timeout 2/help show help
/who members of the current room
/rooms rooms available on the relay
/join #room join another room
/part leave the current room
/msg @name text direct message to one peer
/file <path> send a file to the current room
/nick <name> change nickname
/key <pass> set room passphrase (E2EE)
/me <action> emote
/ping round-trip check to the relay
/clear clear the screen
/quit leave the relay
Files land in --downloads (default blane_downloads/), prefixed with the
sender's short id and verified against the SHA-256 the sender announced; a
mismatch is reported instead of silently accepting a corrupted file.
/who connected clients
/rooms rooms and their member counts
/motd <text> change the message of the day
/kick <name> disconnect a client
/stop shut the relay down
Useful flags: --bind <addr>, --max-clients <n>, --history <n>,
--discovery-port <n>, --no-discovery, --identity <path>, --quiet.
- Handshake — plaintext
BLNE-HELLOline carrying the client's X25519 public key and a random nonce; the relay answers withBLNE-WELCOMEplus its own key and nonce. - Session keys —
HKDF-SHA256(X25519(shared), salt = client_nonce ‖ server_nonce, info = "BLANE/v1/session"), split into independent send/receive keys. - Frames —
[magic "BLNE"][u32 BE length][AEAD ciphertext], 12-byte nonce with a monotonic counter, so replayed or reordered frames fail to decrypt. - Room E2EE — Argon2id(passphrase, salt = SHA-256("BLANE/v1/room/")) →
ChaCha20-Poly1305 key; message bodies are
base64(nonce ‖ ciphertext)and the relay only forwards the blob. - Identities — X25519 keys are persisted on disk and advertised as a 4-byte fingerprint so peers can spot a swapped key.
What this is not: BLANE is not a Tor replacement, there is no forward secrecy across restarts, no key transparency, and a malicious relay can still drop or reorder traffic (it just cannot read E2EE rooms). Treat the passphrase as a shared secret and rotate it per event.
| Target | Artifact | How |
|---|---|---|
| Linux x86_64 | blane-server, blane-client (ELF) |
cargo build --release |
| Windows x86_64 | blane-server.exe, blane-client.exe |
rustup target add x86_64-pc-windows-gnu + llvm-mingw, or native MSVC |
| Android arm64 / armv7 / x86_64 | libblane_mobile.so |
Android NDK + cargo-ndk |
| Any | library | blane-mobile C ABI / JNI |
Prebuilt binaries for every tag live in the
Releases page —
v0.2.0 ships Linux, Windows
and Android artifacts. CI
(.github/workflows/ci.yml) cross-checks Linux, Windows and Android on every
push; release.yml attaches the artifacts to a GitHub Release.
cargo test # 11 unit tests (core) + 2 end-to-end relay testsThe end-to-end tests spin up a real relay on 127.0.0.1, connect two encrypted
clients and assert: welcome/join ordering, room broadcast, E2EE decryption,
direct messages, a 50 KB file in three chunks with SHA-256 verification, and that
a duplicate nickname is refused with join_denied.
crates/blane-mobile builds a cdylib with a plain C ABI
(blane_start, blane_poll, blane_send, blane_command, blane_stop, ...)
and, with --features jni, the Java_com_dxhm_blane_Native_* bridge used by the
sample app in android/. Events arrive as JSON strings:
[{"type":"message","room":"lobby","from":"alice","text":"hi","ts":1764...}]crates/blane-core protocol · crypto · framing · discovery (11 tests)
crates/blane-server relay, rooms, history, admin console (2 e2e tests)
crates/blane-client terminal client (chat / discover / keygen)
crates/blane-mobile C ABI + JNI bridge for Android
android/ sample Kotlin app (Gradle + jniLibs)
docs/ protocol, architecture, build docs, screenshots
scripts/ build helpers (all targets / android)
Issues and PRs are welcome — especially protocol reviews, Android UI work and
fuzzing of the frame layer. Please run cargo fmt, cargo clippy and
cargo test before opening a PR.
GPL-3.0-or-later. See LICENSE.txt.


