Skip to content
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
130 changes: 49 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,51 @@
# DHttp
<p align="center">
<a href="https://www.dhttp.net" title="DHttp home">
<img src="assets/dhttp-logo.svg" width="153" height="48" alt="DHttp">
</a>
</p>
<h3 align="center">Clients can be servers; all endpoints are created equal.</h3>

**DHttp: The True Internet.** Clients are servers, names are identity, and every endpoint should be able to speak HTTP APIs directly.
[![Crates.io](https://img.shields.io/crates/v/dhttp?label=crates.io)](https://crates.io/crates/dhttp)
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
[![Documentation](https://img.shields.io/badge/docs-dhttp.net-ff9900.svg)](https://docs.dhttp.net/en/docs/protocol/dhttp)
[![Rust](https://img.shields.io/badge/rust-1.85%2B-dea584.svg)](https://www.rust-lang.org/)

DHttp is an Apache-2.0 open-source endpoint stack built on QUIC and HTTP/3. It keeps the Web's request/response model, then adds peer-to-peer transport, mutual-TLS identity, endpoint-aware name resolution, and policy-based access control so applications, devices, services, and agents can connect as equals.
HTTP has been the Internet's most widely used protocol for decades, powering the Web and reaching into nearly every corner of the digital world. Yet beneath that prosperity lies a deep structural flaw: HTTP created a hierarchy between clients and servers. Servers became the aristocracy—named, served by DNS, discoverable, and globally callable. Clients remained nameless subjects, continuously sending their data upward for servers to analyze and monetize. This architectural inequality has become the machinery that entrenches **technological feudalism** and perpetuates **data colonialism**.

## What DHttp gives you
DHttp is **Decentralized HTTP on QUIC and HTTP/3**. It extends HTTP: each endpoint is both a client and a server, and domain names extend beyond servers to every endpoint. **A name for every endpoint** seems so basic that we overlook its profound significance: it is the foundation of **Omniconnectivity**, enabling identification, discovery, invocation, authorization, and authentication—all through a simple name. **This is DHttp**—opening a new era of Omniconnectivity for the Internet of Agents.

- **HTTP/3 over QUIC** — secure transport, multiplexed streams, and modern congestion control as the default foundation.
- **Endpoint equality** — an application endpoint can be both a client and a server.
- **Name as identity** — DHttp names and certificates authenticate peers through mutual TLS instead of treating DNS as only a routing hint.
- **Endpoint-aware DNS** — DHttp DNS records can describe reachable endpoint addresses, including private or proxied endpoints.
- **Local-first networking** — LAN-first and peer-to-peer paths are first-class; public infrastructure is used for bootstrap and reachability when needed.
- **Fine-grained access control** — authorize requests by verified identity and HTTP context.
- **Language SDKs** — Rust is the source implementation; native Node.js and Python bindings expose the same endpoint model.
## DHttp vs HTTP

## Repository layout
| "Interconnected"? | HTTP | DHttp |
| --- | :---: | :---: |
| Client to server | ✓ | ✓ |
| Server to server | ✓ | ✓ |
| Client to client | ✗ | ✓ |
| Server to client | ✗ | ✓ |

This repository is a Cargo workspace for the DHttp SDK crates and native bindings:

| Package | Path | Purpose |
| ---------------- | ----------- | -------------------------------------------------------------------------------------------------------------- |
| `dhttp` | `dhttp/` | Endpoint facade for client/server HTTP/3, DNS resolver planning, trust defaults, and QUIC network integration. |
| `dhttp-identity` | `identity/` | DHttp name validation, identity certificates, subject-key metadata, and signing/verification helpers. |
| `dhttp-home` | `home/` | Local DHttp home directory, identity profiles, settings, and certificate/key loading. |
| `dhttp-access` | `access/` | Access-control expressions, matchers, HTTP integration, optional SQLite persistence, and CLI helpers. |
| `dhttp-log` | `log/` | Typed certificate and HTTP access records with bounded built-in compact ASCII formatting. |
| `dhttp-api` | `api/` | Native Node.js (`@genmeta/dhttp`) and Python (`dhttp`) bindings for the endpoint facade. |
> In HTTP, network listening is confined to the server side: servers can accept incoming connections, whereas clients lack this capability. Thus, HTTP provides only partial connectivity, leaving interconnection across the World Wide Web dependent on cloud-hosted infrastructure. DHttp, conversely, establishes client-server equivalence, treats all endpoints with endpoint equality, and achieves **Omniconnectivity** without depending on privileged endpoints such as traditional servers.

Lower-level crates can be used independently, but application code should normally start with the `dhttp` endpoint facade.
## How DHttp Extends HTTP

- **Client and Server in One** — Every client can also listen for incoming connections, and serve HTTP APIs. Each endpoint is both client and server; all endpoints are created equal.
- **Names extend to Clients** — DHttp makes domain names and PKI certificates available to every endpoint, not just servers. Every endpoint deserves a name.
- **EndpointAddress Record** — Every endpoint's network address can be resolved by name, including in private networks; the result is a set of EndpointAddress Records, not just an IP address.
- **Peer-to-Peer Communication** — Using DQuic to traverse NATs, striving to establish a direct peer-to-peer path—including across IPv4 and IPv6 networks—for every connection.
- **Volunteer Relay Network** — Any qualifying endpoint can voluntarily provide relay service for endpoints in private networks.

## DHttp Request Flow

<p align="center">
<img src="assets/dhttp-request-flow.png" alt="A named DHttp request from bob.lee to alice.smith">
</p>

> Bob.Lee makes an DHttp request to Alice.Smith. DDns resolves `alice.smith` to the EndpointAddress record, DQuic establishes the connection, and DHttp carries the request and response.
> Alice.Smith's endpoint resides on a private network and would otherwise be unreachable. With assistance from `3.66.134.55:20002`, it discovers its public address, `208.90.123.177:61901`, establishes a listener, and traverses NAT to form a direct peer-to-peer connection.

## Quick start

### Add the Rust SDK
### Rust SDK

Add the published crate to your Cargo manifest:

Expand All @@ -40,27 +54,18 @@ Add the published crate to your Cargo manifest:
dhttp = "0.6.0-beta.5"
```

Automatic monitoring of local network-interface changes is opt-in:

```toml
[dependencies]
dhttp = { version = "0.6.0-beta.5", features = ["netwatcher"] }
```

The feature activates dquic's interface watcher; it is not part of dhttp's default feature set.

### Build an endpoint
### Client Mode

```rust,no_run
use dhttp::endpoint::Endpoint;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Loads credentials from the DHttp home directory for this name.
let endpoint = Endpoint::load("alice.ma.dhttp.net").await?;
let endpoint = Endpoint::load("alice.smith~").await?;

let mut response = endpoint
.get("https://marisa.mo.dhttp.net/hello")
.get("https://bob.lee~/welcome")
.response()
.await?;

Expand All @@ -69,16 +74,16 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
```

### Serve HTTP APIs from the same endpoint
### Server Mode

```rust,no_run
use dhttp::endpoint::{server::Service, Endpoint};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let endpoint = Endpoint::load("alice.ma.dhttp.net").await?;
let endpoint = Endpoint::load("bob.lee~").await?;

let service = Service::new().get("/hello", |_request, response| async move {
let service = Service::new().get("/welcome", |_request, response| async move {
response.set_body("hello from DHttp");
});

Expand All @@ -87,9 +92,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
```

`Endpoint::load` uses the standard DHttp home profile and enables H3 DNS, mDNS, and system DNS. Use `Endpoint::builder()` when you need custom identity material, DNS schemes, bind patterns, QUIC configuration, or a shared network.

## Node.js and Python bindings
## Node.js and Python SDK

The native bindings mirror the Rust endpoint model while following each ecosystem's conventions.

Expand All @@ -98,8 +101,8 @@ Node.js:
```js
import { Endpoint } from "@genmeta/dhttp";

const endpoint = await Endpoint.create({ dnsSchemes: ["h3", "mdns", "system"] });
const response = await endpoint.fetch("https://alice.example.dhttp.net/hello");
const endpoint = await Endpoint.create();
const response = await endpoint.fetch("https://alice.smith~/welcome");
console.log(await response.text());
```

Expand All @@ -108,45 +111,10 @@ Python:
```python
import dhttpy

endpoint = await dhttpy.Endpoint.create(dns_schemes=["h3", "mdns", "system"])
endpoint = await dhttpy.Endpoint.create()

async with endpoint.get("https://alice.example.dhttp.net/hello") as response:
async with endpoint.get("https://alice.smith~/welcome") as response:
print(await response.text())
```

See [`api/README.md`](api/README.md) for raw stream primitives, high-level service APIs, and binding-specific notes.

## Development

Run commands from this repository root:

```bash
cargo fmt
cargo clippy --all-targets --all-features -- -D warnings
cargo test --workspace
```

Useful package-focused commands:

```bash
cargo test -p dhttp
cargo test -p dhttp-identity
cargo test -p dhttp-home
cargo test -p dhttp-access --all-features
cargo test -p dhttp-log --all-targets
```

Binding builds live under `api/`:

```bash
cd api
npm run build
python -m maturin develop
```

## Learn more

- Website: [dhttp.net](https://dhttp.net/)
- Documentation: [docs.dhttp.net](https://docs.dhttp.net/en/docs/overview)
- Repository: [github.com/genmeta/dhttp](https://github.com/genmeta/dhttp)
- License: Apache-2.0
See [DHttp SDKs](https://docs.dhttp.net/docs/core-components/sdk) for more information.
6 changes: 6 additions & 0 deletions assets/dhttp-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/dhttp-request-flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading