A handy Matrix server resolution library
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Julian Anderson 280df5a795
docs: Move CLI info to README template
and lightly adjust the source code docstring accordingly
2026-11-06 16:50:27 -05:00
.forgejo/workflows feat: Add MSRV enforced by CI 2026-04-12 15:45:30 +01:00
cli feat: Fix clippy recommendations 2026-08-01 18:17:16 +02:00
examples chore: Add example for builder pattern 2026-06-26 19:52:00 +01:00
src docs: Move CLI info to README template 2026-11-06 16:50:27 -05:00
.gitignore chore: Ignore IntelliJ IDE files 2026-08-01 15:00:01 +02:00
.pre-commit-config.yaml chore: Fix docs 2026-03-19 11:24:54 +00:00
Cargo.lock chore: Release 2026-10-13 00:06:10 +02:00
Cargo.toml chore: Release 2026-10-13 00:06:10 +02: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 docs: Add CLI Nix availability and more detail throughout 2026-11-06 14:27:30 -05:00
README.tpl docs: Move CLI info to README template 2026-11-06 16:50:27 -05:00
rust-toolchain.toml chore: Add rust-toolchain.toml 2026-04-12 15:38:38 +01:00

resolvematrix

Dependency status crates.io docs.rs MPL-2.0 license

forgejo.ellis.link Issues Pull Requests GitHub mirror

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 chapter of the Matrix specification.

The library is tested against the https://resolvematrix.dev suite and other live Matrix servers.

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

This repository includes a minimal implementation of the library in the form of a command-line tool.

Usage

Library

cargo add resolvematrix

Example

use resolvematrix::server::{MatrixResolver, MatrixResolverBuilder};

// Create a new resolver
let resolver = Arc::new(MatrixResolver::new()?);
// Or to use custom options:
// MatrixResolverBuilder::new().cache_ttl(Duration::from_secs(10)).build()?

// 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;

For more examples, see the examples directory.

CLI

The CLI is currently available as follows:

RPM

resolvematrix is available as an RPM package through Terra for all of the same Linux distributions as described on Continuwuity's RPM installation page, except for SUSE.

To install, follow Terra's directions for adding the Terra repo on your distribution (note that no subrepos are required for this package), then run sudo dnf install resolvematrix.

Nix

resolvematrix is available from Nixpkgs. To obtain and run the CLI through Nix, you can:

  • Run nix run nixpkgs#resolvematrix, or
  • Add pkgs.resolvematrix to your system configuration

Other platforms

resolvematrix can be compiled from source on most platforms supported by both AWS-LC (on which this tool partially depends) and the Rust compiler (with std support).

This can be accomplished by one of the following methods:

  • Cloning this repository, navigating to the cli/ subdirectory, and running cargo build --release
  • Running the following one-liner, without needing to clone the repository: cargo install --git https://forgejo.ellis.link/continuwuation/resolvematrix resolvematrix-cli

Example

$ resolvematrix continuwuity.org
Resolved continuwuity.org to base URL https://matrix.continuwuity.org:443 using step 3.2 (WellKnownHostPort)
Server is continuwuity version 26.9.1 (ddbdd1e)
Server has signing keys:
- ed25519:PwHlNsFu: 8eNx2s0zWW+heKAmOH5zKv/nCPkEpraDJfGHxDu6hFI

Contributing

Resolvematrix is part of the Continuwuity project. Please see the Contributing guide before submitting a pull request.

Code of Conduct

Contributors are expected to follow the Continuwuity Community Guidelines.