Kulfi & Malai
Open Source, General Purpose, Sovereign, Decentralized, Peer to Peer Internet.
Highlights
- Share your local HTTP/TCP with anyone, without any central server.
- Host your own HTTP bridge using
malai http-bridgeto access exposed services via web browser. - Built on top of iroh, a p2p networking library.
Malai
Malai is a simple tool that can be used to expose any local service (HTTP, TCP and, SSH, etc.) to the world. It can be paired up with an ACL system (like Kulfi) to control access to the exposed services.
Installation
# Clone the repository
# Build malai
# The binary will be available at target/release/malai
Quick Start
Step 1: Run an HTTP bridge (on a server with a public domain):
# On your server (e.g., bridge.example.com)
Step 2: Expose a local HTTP service (e.g., running on port 3000):
# On your local machine
This will generate or use an existing identity and expose your service. The service
will be accessible via https://<your-id52>.bridge.example.com through your HTTP bridge.
Commands
HTTP Service Exposure
Expose a local HTTP service to the kulfi network:
)
)
Example:
Note: You need to run your own HTTP bridge for web browser access. See the HTTP Bridge section below.
TCP Service Exposure
Expose a local TCP service (SSH, database, etc.):
)
Example:
UDP Service Exposure
Expose a local UDP service (DNS, game servers, VoIP, etc.):
)
Example:
TCP+UDP Service Exposure
Expose both TCP and UDP on the same port simultaneously:
)
Example:
Folder Sharing
Share a folder over HTTP:
)
)
Example:
Note: You need to run your own HTTP bridge for web browser access.
Browse Kulfi Sites
Open a kulfi URL in your browser:
HTTP Bridge
Run an HTTP bridge server that forwards requests to kulfi services. You must host your own bridge to access HTTP services via web browser.
)
Setting up your bridge:
- Get a server with a public IP and domain (e.g.,
bridge.example.com) - Configure wildcard DNS:
*.bridge.example.com→ your server IP - Run the bridge:
malai http-bridge --port 80(or use a reverse proxy with SSL) - Use
--bridge bridge.example.comwhen exposing services - Access services at:
https://<id52>.bridge.example.com
TCP Bridge
Run a TCP bridge server that forwards requests to a kulfi service:
<PROXY_TARGET> The
UDP Bridge
Run a UDP bridge server that forwards datagrams to a kulfi service:
<PROXY_TARGET> The
HTTP Proxy
Run an HTTP proxy (requires a remote proxy server):
Identity Management
Generate a new identity:
Create identity in system keyring:
Delete identity from system keyring:
# or
Configuration File
For running multiple services, create a malai.toml file:
[]
= "/var/log/malai.log" # Optional: log file path
[]
= "id52_abc123..." # Optional: specific identity
= "/path/to/secret" # Optional: load identity from file
= 3000
= "127.0.0.1"
= "bridge.example.com" # Your HTTP bridge domain
= true
= true
[]
= 8080
= true
= true
[]
= 22
= "127.0.0.1"
= true
= true
Run all services from config:
# or
# or set MALAI_HOME environment variable
Identity System
Malai uses id52 identities for peer-to-peer connections. Identities can be:
- Generated on-the-fly: If no identity exists, one is created automatically
- Stored in system keyring: Use
malai identity createfor persistent identities - Stored in files: Use secret key files with
secret_fileoption in config - Specified per service: Each service in
malai.tomlcan use a different identity
How HTTP Bridge Works
An HTTP bridge allows you to access kulfi services through standard web browsers. You must host your own bridge on a server with a public domain.
Setup:
- Get a domain (e.g.,
bridge.example.com) pointing to your server - Configure wildcard DNS:
*.bridge.example.com→ server IP - Run bridge:
malai http-bridge --port 80 - Optionally use a reverse proxy (nginx/caddy) for automatic HTTPS
Usage:
- Expose service with bridge:
malai http 3000 --bridge bridge.example.com --public - Your service gets a unique
id52(e.g.,abc123...xyz) - Access via:
https://abc123...xyz.bridge.example.com - The bridge forwards requests to your local service via the kulfi P2P network
Why it's needed: Web browsers can't directly connect to kulfi's P2P protocol. The bridge acts as a gateway, translating HTTP requests to kulfi connections using the subdomain as the target id52.
Environment Variables
MALAI_HTTP_BRIDGE: Default HTTP bridge domain for your services (set to your bridge domain)MALAI_HOME: Default configuration directory formalai run
Example:
Security Notes
- The
--publicflag is required for all service exposure commands as a safety measure - Each service can use a separate identity for access control
- Identities can be managed through the system keyring for security
- Services not marked as
active = truein config will not start
Common Use Cases
Share a Local Development Server
# First, ensure you have an HTTP bridge running on a public server
# On your server: malai http-bridge --port 80
# Start your dev server (e.g., React on port 3000)
# In another terminal, expose it
# Access via https://<your-id52>.bridge.example.com
Remote SSH Access
# Expose SSH service
# On another machine, create a TCP bridge
# Connect via the bridge
Expose a Game Server
# Expose a Minecraft server (uses both TCP and UDP)
# On another machine, create bridges for both protocols
# In another terminal:
# Players can now connect to localhost:25565
Share Files Quickly
# Share current directory (requires HTTP bridge)
# Others can browse via https://<your-id52>.bridge.example.com
Run Multiple Services
Create malai.toml:
[]
= 8080
= true
= true
[]
= 3000
= true
= true
[]
= 5432
= true
= false # Disabled for now
[]
= 53
= true
= true
[]
= 25565
= true
= true
Run all active services:
Kulfi
Kulfi is a peer to peer network, free from any corporate control. Data stays with the user, and devices controlled by the user, and not with some central company.
Kulfi will soon be available as an binary that you can download and run on your computer. We will support Linux, Windows and MacOS from day one. We also want to create Apps that can be distributed through App Stores, and also support mobile devices.
kulfi and malai are built on top of iroh, and uses BitTorrent's
Mainline DHT for peer discovery.
Licence
This project is licensed under the UPL license. UPL is MIT like license, with Apache 2.0 like patent grant clause.
Contributing
We welcome contributions to Kulfi & Malai. Please read the CONTRIBUTING.md file for details on how to contribute.