From 18b61f3d41933c985740563159c21cc368983d23 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Fri, 26 Jun 2026 15:39:30 +0200 Subject: [PATCH] docs(languages): add iroh-go --- docs.json | 1 + languages/go.mdx | 78 +++++++++++++++++++++++++++++++++++++++++++++ languages/index.mdx | 29 +++++++++-------- 3 files changed, 94 insertions(+), 14 deletions(-) create mode 100644 languages/go.mdx diff --git a/docs.json b/docs.json index ff43b1f..c449c54 100644 --- a/docs.json +++ b/docs.json @@ -26,6 +26,7 @@ "languages/swift", "languages/kotlin", "languages/javascript", + "languages/go", "languages/wasm-browser" ] }, diff --git a/languages/go.mdx b/languages/go.mdx new file mode 100644 index 0000000..e00d2e9 --- /dev/null +++ b/languages/go.mdx @@ -0,0 +1,78 @@ +--- +title: "Go" +description: "Use iroh from Go via the [iroh-ffi](https://github.com/n0-computer/iroh-ffi) bindings." +--- + +[`iroh-go`](https://git.coopcloud.tech/decentral1se/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](https://git.coopcloud.tech/decentral1se/iroh-go#motivation). + +| Platform | Architectures | +| --- | --- | +| Linux | x86_64, aarch64 (musl) | + +- **API reference:** [Go API docs](https://godocs.io/git.coopcloud.tech/decentral1se/iroh-go) +- **Examples:** [iroh-go/examples](https://git.coopcloud.tech/decentral1se/iroh-go/src/branch/main/examples) +- **All languages:** [platform support matrix](/languages#platform-support) + +## Install + +We're aiming to publish a stable tag once we see more usage and adoption of the +Go bindings. + +```bash +go get git.coopcloud.tech/decentral1se/iroh-go +``` + +## Hello, iroh + +```go +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 + + + Connect two endpoints and stream messages between them. + + + + Connect multiple endpoints and broadcast messages. + + + + Source, examples, and issue tracker for the iroh Go FFI bindings. Contributions are welcome! + diff --git a/languages/index.mdx b/languages/index.mdx index 34839f2..1f9c13a 100644 --- a/languages/index.mdx +++ b/languages/index.mdx @@ -1,6 +1,6 @@ --- title: "Overview" -description: "Use iroh from Rust, Python, Swift, Kotlin, or JavaScript." +description: "Use iroh from Rust, Python, Swift, Kotlin, JavaScript or Go." --- iroh is available in Rust, Python, Swift, Kotlin, and JavaScript. Pick the language that fits your app and follow its guide to get a working endpoint in minutes. @@ -12,6 +12,7 @@ iroh is available in Rust, Python, Swift, Kotlin, and JavaScript. Pick the langu | [Swift](/languages/swift) | Official | iOS + macOS | | [Kotlin](/languages/kotlin) | Official | JVM + Android | | [JavaScript](/languages/javascript) | Official | Node.js via N-API | +| [Go](/languages/go) | Community | FFI bindings via [iroh-ffi](https://github.com/n0-computer/iroh-ffi) | All five official bindings share the same basic API surface for sending streams or datagrams over QUIC. The Rust language bindings are the most complete and @@ -25,19 +26,19 @@ up-to-date, and contain custom configuration and protocol features. The [n0.computer](https://n0.computer) team offers official support for the following platforms. -| Platform | Rust | Python | Swift | Kotlin | JavaScript | -| --- | --- | --- | --- | --- | --- | -| iOS (device + sim) | ✓ | — | ✓ | — | — | -| Android (aarch64, armv7) | ✓ | — | — | ✓ | ✓ | -| macOS arm64 | ✓ | ✓ | ✓ | ✓ | ✓ | -| macOS x86_64 | ✓ | ✓ | ✗ | ✓ | ✗ | -| Linux x86_64 (glibc) | ✓ | ✓ | — | ✓ | ✓ | -| Linux x86_64 (musl) | ✓ | ✗ | — | ✗ | ✓ | -| Linux aarch64 (glibc) | ✓ | ✓ | — | ✓ | ✓ | -| Linux aarch64 (musl) | ✓ | ✗ | — | ✗ | ✓ | -| Linux armv7 | ✓ | ✗ | — | ✗ | ✓ | -| Windows x86_64 | ✓ | ✓ | — | ✓ | ✓ | -| Windows aarch64 | ✓ | ✗ | — | ✗ | ✓ | +| Platform | Rust | Python | Swift | Kotlin | JavaScript | Go | +| --- | --- | --- | --- | --- | --- | -- | +| iOS (device + sim) | ✓ | — | ✓ | — | — | - | +| Android (aarch64, armv7) | ✓ | — | — | ✓ | ✓ | - | +| macOS arm64 | ✓ | ✓ | ✓ | ✓ | ✓ | - | +| macOS x86_64 | ✓ | ✓ | ✗ | ✓ | ✗ | - | +| Linux x86_64 (glibc) | ✓ | ✓ | — | ✓ | ✓ | - | +| Linux x86_64 (musl) | ✓ | ✗ | — | ✗ | ✓ | ✓ | +| Linux aarch64 (glibc) | ✓ | ✓ | — | ✓ | ✓ | - | +| Linux aarch64 (musl) | ✓ | ✗ | — | ✗ | ✓ | ✓ | +| Linux armv7 | ✓ | ✗ | — | ✗ | ✓ | - | +| Windows x86_64 | ✓ | ✓ | — | ✓ | ✓ | - | +| Windows aarch64 | ✓ | ✗ | — | ✗ | ✓ | - | Get in touch and tell us what you're building. We can prioritize new bindings or help you maintain your own.