Skip to main content
iroh-go is still considered experimental but ready for testing and open for contribution to improve the quality and reliability of the bindings. There is a specific focus on making the installation and cross platform support as simple as possible.
PlatformArchitectures
Linuxx86_64, aarch64 (musl)

Install

We’re aiming to publish a stable tag once we see more usage and adoption of the Go bindings.
go get git.coopcloud.tech/decentral1se/iroh-go

Hello, iroh

package main

import (
  "fmt"

  iroh "git.coopcloud.tech/decentral1se/iroh-go"
)

var (
  alpn = []byte("iroh-go-hello/0")
)

func main() {
  preset := iroh.PresetN0()
  opts := iroh.EndpointOptions{
    Preset: &preset,
    Alpns:  &[][]byte{alpn},
  }

  endpoint, err := iroh.EndpointBind(opts)
  if err != nil {
    panic(err)
  }

  endpoint.Online()

  fmt.Println("endpoint id:", endpoint.Id())
}
This binds an endpoint using the N0 preset (public discovery + default relays), waits until it has a home relay, and prints its 64-character endpoint id. Run it with go run.

Next steps

Bidirectional chat

Connect two endpoints and stream messages between them.

Multiple live connections

Connect multiple endpoints and broadcast messages.

iroh-go repository

Source, examples, and issue tracker for the iroh Go FFI bindings. Contributions are welcome!