# What Programming Languages Are Used in Iroh? A Rust Codebase Analysis

> Discover the programming languages powering the n0-computer/iroh project. Explore its Rust codebase and supporting scripts for a deep dive into this innovative technology.

- Repository: [number zero/iroh](https://github.com/n0-computer/iroh)
- Tags: analysis
- Published: 2026-07-12

---

**The iroh repository is written almost entirely in Rust**, with supplemental Bash shell scripts and Dockerfiles supporting the build and test infrastructure.

The iroh project by n0-computer/iroh is a peer-to-peer networking stack that relies on specific programming languages to deliver high-performance QUIC-based connectivity. Understanding what programming languages are used in iroh helps developers contribute effectively and integrate the library into their own projects. While the core implementation uses a single primary language, the repository includes additional tooling scripts that support continuous integration and deployment.

## Primary Language: Rust

The iroh codebase is implemented almost entirely in **Rust**. All core crates—including `iroh`, `iroh-base`, `iroh-relay`, `iroh-dns`, and supporting utilities—are Rust libraries or binaries. These components handle peer-to-peer networking, QUIC-based connections, relay client/server functionality, and DNS server implementations.

The workspace configuration in [`Cargo.toml`](https://github.com/n0-computer/iroh/blob/main/Cargo.toml) at the repository root declares these member crates and manages dependencies across the project. No other programming languages such as Go, Python, or JavaScript are present in the core repository itself.

## Core Architecture and Source Files

### Main Library Interface

The central library exposing the high-level API is defined in [`iroh/src/lib.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/src/lib.rs). This file contains core types such as `Endpoint` and `EndpointAddr`, which provide the primary interface for establishing peer-to-peer connections according to the library architecture.

### Relay Server Implementation

The relay server binary entry-point resides in [`iroh-relay/src/main.rs`](https://github.com/n0-computer/iroh/blob/main/iroh-relay/src/main.rs). This component implements the relay functionality that assists with NAT traversal and connectivity between peers when direct connections are not possible.

### Example Applications

Practical usage patterns are demonstrated in [`iroh/examples/echo.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/examples/echo.rs), which shows how to implement a simple echo protocol using the iroh library to exchange messages between endpoints.

## Build and Test Infrastructure

While the implementation is pure Rust, the repository includes supporting scripts and configuration files that facilitate development workflows.

### Shell Scripts

**Bash** scripts facilitate testing and CI workflows. For example, [`iroh-relay/tests/multiple-hostnames-pebble.sh`](https://github.com/n0-computer/iroh/blob/main/iroh-relay/tests/multiple-hostnames-pebble.sh) is used in relay integration tests to orchestrate complex test scenarios involving multiple hostnames.

### Configuration Files

**TOML** files—including [`Cargo.toml`](https://github.com/n0-computer/iroh/blob/main/Cargo.toml), `Cargo.lock`, and various workspace configurations—define the build structure and dependencies. Additionally, **Dockerfiles** provide container definitions for CI environments and deployment images.

## Code Example: Working with Iroh in Rust

Below is a minimal Rust example that creates an iroh endpoint, opens a connection to a peer, and exchanges a message over a bidirectional QUIC stream. The snippet mirrors the patterns shown in the library documentation.

```rust
use iroh::{Endpoint, EndpointAddr, endpoint::presets};
use n0_error::{Result, StackResultExt, StdResultExt};

#[tokio::main]
async fn main() -> Result<()> {
    // Bind a local endpoint using the default preset (relay + direct addresses)
    let ep = Endpoint::bind(presets::N0).await?;

    // The peer’s address (normally obtained via DNS, relay, or out‑of‑band)
    let peer: EndpointAddr = todo!("obtain peer address");

    // Connect to the peer, specifying an application‑layer protocol identifier
    let conn = ep.connect(peer, b"my-alpn").await?;

    // Open a bidirectional stream and exchange data
    let (mut send, mut recv) = conn.open_bi().await?;
    send.write_all(b"hello iroh").await?;
    send.finish()?;
    let response = recv.read_to_end(1024).await?;

    println!("Received: {}", String::from_utf8_lossy(&response));
    Ok(())
}

```

## Summary

- iroh is implemented **exclusively in Rust**, with all core logic residing in Rust crates.
- The main API is exposed through [`iroh/src/lib.rs`](https://github.com/n0-computer/iroh/blob/main/iroh/src/lib.rs), featuring types like `Endpoint` and `EndpointAddr`.
- Build configuration is managed via **TOML** files in the Cargo workspace defined at the repository root.
- **Bash** shell scripts and **Dockerfiles** support testing and CI but do not implement core functionality.
- Language bindings for other languages (like Python or JavaScript) exist in separate repositories (iroh-ffi), not in the main iroh codebase.

## Frequently Asked Questions

### Is iroh written in Go?

No, iroh is written in Rust. While many peer-to-peer networking tools use Go, iroh specifically chose Rust for its memory safety guarantees and performance characteristics suitable for QUIC-based networking.

### Can I use iroh with Python or JavaScript?

Yes, but not directly from this repository. The README mentions that other languages can interact with iroh via the separate **iroh-ffi** bindings, which live in a different repository. The core iroh repository contains only Rust code.

### What build system does iroh use?

iroh uses **Cargo**, the Rust build system and package manager. The workspace is defined in the root [`Cargo.toml`](https://github.com/n0-computer/iroh/blob/main/Cargo.toml), which lists all member crates including `iroh`, `iroh-base`, `iroh-relay`, and `iroh-dns`.

### Does iroh contain any C or C++ components?

No, iroh does not contain C or C++ source code. The implementation is pure Rust, though it may depend on Rust crates that wrap C libraries for specific platform functionalities.