---
title: API map
description: Which package holds which type, and the entry point for each task.
icon: compass
---

Lookup material. The authority is `go doc` and
[pkg.go.dev/github.com/tmc/go-iroh](https://pkg.go.dev/github.com/tmc/go-iroh);
this page is the index that gets you to the right package.

```sh
go doc github.com/tmc/go-iroh/iroh Endpoint
go doc github.com/tmc/go-iroh/netaddr EndpointAddr
```

## Entry points by task

| Task | Call |
| --- | --- |
| Create an endpoint | `iroh.Bind(ctx, opts...)` |
| Shut it down | `(*iroh.Endpoint).Shutdown(ctx)` |
| Serve protocols by ALPN | `iroh.NewRouter(ep, handlers, cfg)` |
| Accept one connection | `(*iroh.Endpoint).Accept(ctx)` |
| Inspect before accepting | `(*iroh.Endpoint).AcceptIncoming(ctx)` |
| Dial | `(*iroh.Endpoint).Connect(ctx, addr, alpn)` |
| Dial with 0-RTT | `(*iroh.Endpoint).ConnectEarly(ctx, addr, alpn)` |
| Get a `net.Conn` | `(*iroh.Endpoint).Dial(...)`, `(*iroh.Conn).OpenStreamConn(ctx)` |
| Open a stream | `(*iroh.Conn).OpenStreamSync(ctx)` |
| Send a datagram | `(*iroh.Conn).SendDatagram(p)` |
| Read my address | `(*iroh.Endpoint).Addr()`, `.WatchAddr()` |
| Wait for a relay | `(*iroh.Endpoint).Online(ctx)` |
| Build an address | `netaddr.NewEndpointAddr(id).WithIP(...)/.WithRelayURL(...)` |
| Share an address | `endpointticket.Encode(addr)` / `.Decode(s)` |
| Configure relays | `iroh.WithRelayMode(relay.Mode…)` |
| Configure discovery | `iroh.WithAddressLookup(&services)` |
| Generate a key | `key.GenerateSecretKey()` |
| Inspect paths | `(*iroh.Conn).Paths()`, `.WatchPaths(ctx)` |
| Read counters | `(*iroh.Endpoint).Metrics()` |

## Packages

### Connectivity

| Package | Key names |
| --- | --- |
| `iroh` | `Bind`, `Option` (`WithSecretKey`, `WithALPNs`, `WithBindAddr`, `WithRelayMode`, `WithAddressLookup`, `WithNetReport`, `WithPathSelector`, `WithCustomTransport`, `WithoutIPTransports`, `WithoutRelayTransports`, …), `Endpoint`, `Conn`, `Stream`, `SendStream`, `ReceiveStream`, `StreamListener`, `Incoming`, `Connecting`, `Router`, `ProtocolHandler`, `ProtocolHandlerFunc`, `PathInfo`, `NetReport`, `RemoteInfo`, `RelayStatus`, `AddressLookupServices`, `AddressPublisher`, `AddressResolver`, `Item`, sentinel errors |
| `key` | `SecretKey`, `PublicKey`, `EndpointID`, `GenerateSecretKey`, `EndpointID.Z32` |
| `netaddr` | `EndpointAddr`, `NewEndpointAddr`, `TransportAddr`, `IPAddr`, `RelayAddr`, `CustomAddr`, `ParseTransportAddr`, `RelayURL`, `ParseRelayURL` |
| `relay` | `Mode` (`ModeDefault`, `ModeStaging`, `ModeCustom`, `ModeCustomURLs`, `ModeDisabled`), `Map`, `Config`, `QUICConfig`, `RankByLatency`, `HTTPConnectProber`, `DefaultQUICPort` |
| `relayserver` | the embeddable relay server |
| `dns` | `Resolver`, `EndpointData`, `EndpointInfo`, `N0DNSEndpointOriginProd` |
| `pkarr` | the signed DNS packet codec |
| `dnsserver` | the embeddable DNS/pkarr server |
| `iroh/mdns` | `New`, `Discovery`, `WithServiceName`, `WithPassive`, `WithLookupTimeout`, `DefaultServiceName` |
| `watch` | `Value`, `Observer` |
| `metrics` | the OpenMetrics registry |

### Protocols

| Package | Key names |
| --- | --- |
| `blobs` | `ALPN`, `Hash`, `Ticket`, `Store`, `ServeBlob`, `ServeBlobStreams`, `DownloadBlob`, `DownloadBlobRange`, `DownloadBlobParallel`, `GetBlobBytes`, `GetManyBlobBytes`, `Observe`, `DecodeBlob*` |
| `gossip` | `ALPN`, `NewGossip`, `Gossip`, `Topic`, `TopicID`, `Sender`, `Receiver`, `Event`, `EventKind`, `JoinOptions`, `Discovery`, `DefaultDiscoveryTopic` |
| `docs` | `ALPN`, `Author`, `AuthorID`, `NamespaceID`, `NamespaceSecret`, `Capability`, `Entry`, `Record`, `DocTicket`, `Handler` |
| `endpointticket` | `Encode`, `Decode`, `Ticket`, `Registry`, `Kind` |
| `postcard` | the postcard wire codec |
| `irpc` | `Call[Req, Resp]`, `Handler`, `Responder` |
| `quicconn` | `NewConn`, `Conn`, `BidiStream`, `SendStream`, `ReceiveStream` |

Anything under `internal/` — the relay client and protocol, net reports, socket
management, `qng`, `itls` — is not API and can change without notice.

## Constants worth knowing

`iroh` exports the behavioral constants it shares with Rust iroh, each cited to
the Rust source in its doc comment: `HeartbeatInterval` (5s),
`PathMaxIdleTimeout`, `RelayPathMaxIdleTimeout`, `MaxMultipathPaths` (8),
`MaxQNTAddresses` (32), and `ConnectTimeout` (10s).

## Next steps

- [Endpoints and connections](endpoints-and-connections) — these calls in
  context.
- [Module index](repo-index) — the generated inventory of modules and
  packages.
