Skip to content
This repository was archived by the owner on Feb 28, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 105 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,68 +1,141 @@
![License](https://img.shields.io/badge/License-GPLv3-blue.svg)
![Build Status](https://img.shields.io/github/actions/workflow/status/pushkar-gr/ghostlink/ci.yml?label=Build)
![Made with Love](https://img.shields.io/badge/Made%20with-Rust-orange.svg)
<div align="center">
<img src="./static/banner.png" alt="GhostLink Banner" width="100%">

<a href="https://github.com/pushkar-gr/ghostlink/actions">
<img src="https://img.shields.io/github/actions/workflow/status/pushkar-gr/ghostlink/ci.yml?label=Build&style=for-the-badge&logo=github" alt="Build Status">
</a>
<a href="https://github.com/pushkar-gr/ghostlink/releases">
<img src="https://img.shields.io/github/v/release/pushkar-gr/ghostlink?label=Version&style=for-the-badge&color=007ec6" alt="Latest Version">
</a>
<a href="https://github.com/pushkar-gr/ghostlink/blob/main/LICENSE">
<img src="https://img.shields.io/badge/License-GPLv3-blue.svg?style=for-the-badge" alt="License">
</a>
<a href="https://www.rust-lang.org/">
<img src="https://img.shields.io/badge/Made%20With-Rust-orange?style=for-the-badge&logo=rust" alt="Language">
</a>
</div>

# 👻 GhostLink

**High-Performance Serverless P2P Messaging**

GhostLink is a decentralized chat application engineered for direct peer-to-peer communication. By leveraging UDP hole punching and a custom reliability layer, it eliminates the need for central relay servers, ensuring messages travel the shortest path possible between peers.

This project prioritizes low-latency networking, asynchronous runtime efficiency, and clean architecture.

---

# 👻 GhostLink
## 🗺️ Roadmap & Status

| Version | Status | Description |
|---------|--------------|---------------------------------------------------------------------------------------------------------------|
| v1.0 | **Stable** | Current release. Feature complete for text exchange and reliable UDP transport. |
| v1.1 | **In Progress** | Security Hardening (QUIC). Replacing the KCP stack with QUIC (via `quinn`) to implement TLS 1.3 End-to-End Encryption. |

---

## ⚙️ Architectural Overview

GhostLink operates by decoupling the Web Interface from the P2P Networking Core, bridging them via shared thread-safe state.

[![](https://mermaid.ink/img/pako:eNqFVFtv2jAU_iuWHyYqESBcSskQUkt3QYOWNUVIW_ZgklNikdiZ7YzSqv99xwnXdWrzdI59vu87t_iZhjIC6lHHcQIRSvHAl14gCDExpOARAdKJmFoFogh4SOQ6jJkyZHyHUTpfLBXLYmt8sUbjZ0CnCjQIwwyXgozZBhSpzEZnAf1lectvDguM7C8GaJCJjPIE-vXFoL9Qg8vHPK3PmcqID-oPqC0ORPQ_QRdphlIYJRMyTZgAUrmPgVwpxsWp5DYqAVUqTzDi6HAn72PiQCYsjDmSfWBp9pEMYyYEJPqEbwJasyUXyy3dziVjueThjg6hhnzl2ki12bJ9liplxmDo26U1kfheMaEzaftdNvIOEs4WPOFmc1qefz-7KTOxVtE7Hu6bes11KLGZmxPMt-G0hKBB5qiZHfpwJLTN-1ZFoN7NuoWMN2DWUq32ObM1GdVv_8lXhiswpfzserr1yR1omatD4n6GGRCfi1XdNwpY-rZ6Gwm_xFKbMSLIpcIpGghNruBEfL-ur4_c10fN10etQw7lNpO-4-z3BPddY-FDmaZMRPqMOM7gaNVK0MHHa6z7dw7akNGUVK6kUnK97UgJtjMtYcV0nRr5nuM0Sc3eFXHHt5YOaxaW7X3pkeCGs4Q_AW6N1vavtaD9QpeYw37bSq82BnQRhqtTBtgdsld22lNmUyoDjtM7FZ5lEbM0Fd__VJ_7ZaXYS1qlS8Uj6hmVQ5WmgP-LdemzZQlo8TQF1EOzeJpoIF4QkzHxQ8p0B1MyX8bUe2CJRi8vtK45w305hOAEQQ1lLgz1Wm5BQb1n-kg9t9eqNc4vXLfTbLVb3U6VbqjnNBu13oXbcbvdntttXzTa3ZcqfSpE3VoDMW6v0eueu63OebtKIeL420_K97V8WunLX189u5E?type=png)](https://mermaid.live/edit#pako:eNqFVFtv2jAU_iuWHyYqESBcSskQUkt3QYOWNUVIW_ZgklNikd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RV3boRh34njDoeedjJzxgCENlJA37Z8Mmot5tmBP_wHtB3Ud)

Welcome to **GhostLink**! This is a serverless P2P chat application built with love (and a lot of Rust). It helps you connect directly with a friend without needing big central servers, complicated setups, or port forwarding headaches. It just works!
1. **Initialization**: The application starts the Axum web server and the Tokio UDP listener simultaneously.
2. **Discovery**: The UDP layer queries a STUN server to resolve the machine's Public IP and punch a NAT hole.
3. **Signaling**: The user manually exchanges Public IPs with a peer via the Web UI.
4. **Transport**: Messages are routed from the UI → Shared State → KCP Stream → Peer.

---

## ✨ What is it?
## 🚀 Key Technical Features

Imagine two tin cans connected by a string, but digital and engineered for speed. GhostLink lets you establish a direct link with another computer anywhere in the world.
- **True Peer-to-Peer**: Direct client-to-client connections minimize latency and remove dependency on third-party infrastructure.
- **Reliable UDP (ARQ)**: Utilizes KCP (via `tokio_kcp`) to provide TCP-like reliability with the speed advantages of UDP.
- **Automated NAT Traversal**: Integrated STUN client allows for seamless connectivity across different network configurations without manual port forwarding.
- **Asynchronous Core**: Built entirely on the Tokio runtime for non-blocking I/O and high concurrency.
- **Real-Time Updates**: State changes are pushed to the browser immediately via Server-Sent Events (SSE).

* **No Intermediaries:** Your messages go straight to your friend.
* **Serverless:** We use a little magic (called STUN) to find each other, but the chat is all you.
* **Web Interface:** Comes with a clean, dark-mode UI that runs right in your browser.
---

## 🛠️ Technology Stack

| Component | Technology | Role |
|---------------|---------------|-----------------------------------------------------|
| Runtime | Tokio | Asynchronous I/O scheduler and task management. |
| Transport | Tokio KCP | Reliable UDP protocol implementation. |
| Web Framework | Axum | HTTP/REST interface and SSE stream handling. |
| State | Arc/RwLock | Thread-safe state synchronization between tasks. |
| Discovery | STUN | Public IP resolution and NAT hole punching. |

## ⚠️ A Little Heads-Up (Important!)
---

## 🔒 Security Notice

While GhostLink is super cool for direct chats, please keep this in mind:
> **WARNING**: *Protocol Status: Cleartext*

**There is NO Encryption.** 🔓
GhostLink v1.0 transmits data in plain text. While the transport layer provides reliability, it does not currently implement end-to-end encryption.

Think of this like passing a note in class or shouting across a playground. It's fast and direct, but it sends data as "plain text." Please **do not** send passwords, credit card numbers, or your deepest secrets over this link just yet. It's strictly for fun, casual chats!
Do not transmit sensitive data (PII, credentials, financial information) over this version. Encryption is slated for the v1.1 release cycle (via QUIC).

## 🛠️ Under the Hood (For the Geeks)
---

We didn't just throw this together; we built it on a robust asynchronous stack. Here is the tech that makes the ghost fly:
## 📦 Installation & Usage

* **Runtime:** Built on **Tokio** for asynchronous, non-blocking I/O, ensuring the app stays responsive even when juggling network packets.
* **Web Framework:** The UI is served by **Axum**, which also handles the REST API and pushes real-time updates to your browser via **Server-Sent Events (SSE)**.
* **Reliability:** We use **KCP** (via `tokio_kcp`) over UDP. This gives us the speed of UDP with the reliability of TCP (ARQ), meaning your messages won't get lost even if the network is a bit shaky.
* **NAT Traversal:** We implement **STUN** (Session Traversal Utilities for NAT) to punch holes through routers, allowing direct P2P connections without manual port forwarding.
* **State Management:** Thread-safe state sharing using `Arc<RwLock<AppState>>`, bridging the gap between the web server and the UDP network controller.
### Prerequisites

## 🚀 How to Run It
Ensure you have the latest stable version of Rust and Cargo installed.

Getting started is easy if you have Rust installed.
### Quick Start

1. **Clone the repo:**
**Step 1**: Clone the repository.
```bash
git clone https://github.com/pushkar-gr/ghostlink.git
cd ghostlink
```

**Step 2**: Build and run.
```bash
cargo run --release
```

The first build may take a moment to compile dependencies.

2. **Fire it up:**
```bash
cargo run
**Step 3**: Initiate Connection.
- Navigate to `http://localhost:8080` in your web browser.
- Copy your Public IP displayed on the dashboard.
- Share your IP with a friend and input their IP into the Target Address field.
- Click **Establish Link**.

```
---

## 🤝 Contributing

We welcome contributions! 🚀

1. Fork the repository.
2. Create a feature branch.
```bash
git checkout -b feature/amazing-feature
```
3. Commit your changes.
```bash
git commit -m "Add some amazing feature"
```
4. Push to the branch.
```bash
git push origin feature/amazing-feature
```
5. Open a Pull Request.

3. **Start Chatting:**
Open your browser and go to `http://localhost:8080`. Send your public IP to a friend, put their IP in the box, and hit **Establish Link**!
---

## 📄 License

This project is open-source and available under the **GNU General Public License v3.0**. Feel free to tinker, fork, and play around with it!
This project is open-source and available under the **GNU General Public License v3.0**. See the [LICENSE](./LICENSE) file for details.

---

Expand Down
Binary file added static/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading