Go FFI bindings for iroh https://iroh.computer
  • Go 73.3%
  • C 26.3%
  • Shell 0.3%
Find a file
2026-11-17 14:43:34 +01:00
.gitea chore: pr template 2026-10-14 20:29:31 +02:00
endpoint feat: shared token support 2026-11-17 13:12:32 +01:00
examples docs: also manual approach 2026-11-17 14:43:34 +01:00
iroh-go feat: iroh-ffi v1.2.0 2026-10-31 19:17:53 +01:00
libs chore: build with new rust stable 2026-11-13 20:28:18 +01:00
licenses feat: apache2 & mit licenses 2026-06-28 00:11:53 +02:00
scripts feat: add aarch64-unknown-linux-musl 2026-06-26 06:40:52 +02:00
util feat: unit tests 2026-11-09 19:09:28 +01:00
.drone.yml feat: unit tests 2026-11-09 19:09:28 +01:00
.gitignore feat: shared token support 2026-11-17 13:12:32 +01:00
alpns.go feat: unit tests 2026-11-09 19:09:28 +01:00
CONTRIBUTING.md build: justfile 2026-11-13 18:59:16 +01:00
endpoint.go feat: unit tests 2026-11-09 19:09:28 +01:00
endpoint_test.go feat: unit tests 2026-11-09 19:09:28 +01:00
errors.go refactor: rework examples, wording and fmt.Errorf 2026-07-31 21:17:40 +02:00
go.mod fix: go mod tidy 2026-11-13 18:56:46 +01:00
go.sum fix: go mod tidy 2026-11-13 18:56:46 +01:00
interfaces.go feat: unit tests 2026-11-09 19:09:28 +01:00
iroh_ffi.go feat: iroh-ffi v1.2.0 2026-10-31 19:17:53 +01:00
iroh_ffi.h feat: iroh-ffi v1.2.0 2026-10-31 19:17:53 +01:00
justfile build: test via justfile 2026-11-13 20:27:37 +01:00
libs.go feat: add aarch64-unknown-linux-musl 2026-06-26 06:40:52 +02:00
logger.go feat: unit tests 2026-11-09 19:09:28 +01:00
pipe.go feat: unit tests 2026-11-09 19:09:28 +01:00
pipe_test.go feat: unit tests 2026-11-09 19:09:28 +01:00
README.md docs: note on level of polish [ci skip] 2026-11-09 19:15:35 +01:00
stream.go feat: unit tests 2026-11-09 19:09:28 +01:00

iroh-go

Build Status

WARNING Highly Experimental ™️

Go FFI bindings for iroh via iroh-ffi.

Motivation

The goal is to provide, as far as possible, seamless "just go build it" support for Go iroh hackers without requiring them to deal with shared libraries, the Rust toolchain or a deepdive in how FFI works. The current approach is to embed libiroh as a staticlib built with Rust for each platform. We use musl to avoid glibc incompatibilities on different linux systems. It's then possible to build a static binary with go build or with Zig. iroh-go does require CGO_ENABLED=1.

Approach

iroh-go is generated directly from iroh-ffi guaranteeing compatibility and long-term alignment with upstream. Some API wrappers are implemented to smooth over some of the unavoidable rough edges of FFI binding generation. This is a different approach than e.g. go-iroh which is a custom port.

Version support

Platform support

NOTE More platform can be provided on request and pending some support to build binaries for specific architectures. If you would like to help out, please let us know! See #8 and #9 for more.

  • x86_64-unknown-linux-musl
  • aarch64-unknown-linux-musl

Documentation

Examples

See examples. Some of them use the API wrapper, and some of them use the low-level API bindings. We're still experimenting. See also the upstream examples (in Rust) for inspiration.

Generate bindings

See iroh-go for the Rust toolchain configuration. Run ./scripts/generate.sh to build a new set of libraries which end up vendored in libs.

Who is using it?

NOTE Please add your own if you're using iroh-go 🙏

Known issues

  • We patched the upstream iroh-ffi endpoint.rs to fix an incompatibility with uniffi-bindgen-go. See this commit for more.
  • We patched the upstream iroh-ffi Cargo.toml to remove the crate-type configuration when runnings builds here. See this commit for more.
  • Error handling is not super ergonomic due to iroh-ffi#263. We have created an error handling wrapper API which is documented in ./examples/errors to improve on the situation.
  • Some interfaces such as conn.Closed() and endpoint.Online() should ideally expose a send/receive channel interface but instead work as a blocking call (where .await() is called internally).

Licenses

Apache 2.0 & MIT, following the upstream licensing choices in iroh-ffi.

Contributing

CONTRIBUTING.md.