> For the complete documentation index, see [llms.txt](https://xrho.gitbook.io/rho/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://xrho.gitbook.io/rho/reach/api.md).

# API Reference

## Class: `Reach`

**Header:** `#include <Lines/Reach.hpp>`

### Construction

```cpp
Reach reach;
```

### Configuration

```cpp
// Add default servers (Reach will query these)
reach.addDefault(serverAddress, serverPublicKey);

// BFT timeout (default: 200ms)
reach.bftTimeoutUS = 200000;
```

### Starting Resolution

```cpp
// Start resolving an address
reach.start(station, "game.example.com");
```

### Ticking

```cpp
// Must be called in your main loop
reach.update();
```

### State

| Property         | Type                      | Description                                    |
| ---------------- | ------------------------- | ---------------------------------------------- |
| `done`           | `bool`                    | Resolution has completed (success or failure)  |
| `success`        | `bool`                    | Resolution succeeded                           |
| `finalAddress`   | `NumericalAddress`        | The resolved address (valid when success=true) |
| `finalPublicKey` | `String`                  | The target's public key (if provided)          |
| `meta`           | `Map<u64, String>`        | Accumulated metadata from the resolution chain |
| `susDefaults`    | `Array<NumericalAddress>` | Servers marked as suspicious                   |

### Cleanup

```cpp
// Stop and free all resources
reach.destroy();
```

### Full Example

```cpp
Bind bind("0.0.0.0:0");
Station station;
station.hook(bind);

Reach reach;
reach.addDefault({10, 1}, server1Key);
reach.addDefault({10, 2}, server2Key);
reach.addDefault({10, 3}, server3Key);

reach.start(station, "game.example.com");

while (!reach.done) {
    bind.update();
    reach.update();
    usleep(1000);
}

if (reach.success) {
    printf("Resolved to: ");
    for (usz i = 0; i < reach.finalAddress.size(); ++i) {
        printf("%lu.", reach.finalAddress[i]);
    }
    printf("\n");
} else {
    printf("Resolution failed. %zu servers marked suspicious.\n",
           reach.susDefaults.size());
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xrho.gitbook.io/rho/reach/api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
