A handy Matrix server resolution library
Find a file
Jade Ellis 22e5fc1075
All checks were successful
Checks / Prek / Pre-commit & Formatting (push) Successful in 2m1s
Checks / Prek / Clippy and Cargo Tests (push) Successful in 4m23s
style: Fix clippy lints in tests
2026-04-12 15:47:38 +01:00
.forgejo/workflows feat: Add MSRV enforced by CI 2026-04-12 15:45:30 +01:00
examples style: Clippy pedantic 2026-03-19 11:17:23 +00:00
src style: Fix clippy lints in tests 2026-04-12 15:47:38 +01:00
.gitignore chore: Initial commit 2026-03-17 16:45:55 +00:00
.pre-commit-config.yaml chore: Fix docs 2026-03-19 11:24:54 +00:00
Cargo.lock chore: Release resolvematrix version 0.0.4 2026-04-12 15:29:19 +01:00
Cargo.toml feat: Add MSRV enforced by CI 2026-04-12 15:45:30 +01:00
committed.toml chore: Add committed config 2026-03-19 11:19:20 +00:00
LICENSE chore: Initial commit 2026-03-17 16:45:55 +00:00
README.md chore: Fix docs 2026-03-19 11:24:54 +00:00
README.tpl docs: Document library usage 2026-03-19 11:09:47 +00:00
rust-toolchain.toml chore: Add rust-toolchain.toml 2026-04-12 15:38:38 +01:00

resolvematrix

Dependency status crates.io docs.rs

forgejo.ellis.link Issues Pull Requests

GitHub

resolvematrix is a Rust library providing the ability to resolve Matrix server-to-server endpoints from the server name. It conforms to the Server Discovery section in the Matrix specification.

The library is tested against the resolvematrix.dev suite and live domains.

This library depends on hickory-resolver, reqwest, serde and (indirectly) tokio.

Usage

cargo add resolvematrix

Example

use resolvematrix::server::MatrixResolver;

// Create a new resolver
let resolver = Arc::new(MatrixResolver::new()?);

// Resolve a server name
let server_name = "matrix.org";
let resolution = resolver.resolve_server(server_name).await?;
eprintln!("Resolved server: {resolution:?}");

let client = resolver.create_client().unwrap();
let url = format!("{}/_matrix/federation/v1/version", resolution.base_url());
let response = client.get(&url).send().await;

License: MPL-2.0