Skip to main content

Go

Go binding

Status

Planned. Development will begin after the Python binding stabilizes.

Timeline

The Go binding is expected to follow the JVM and .NET bindings in priority.

Architecture

The Go binding will use the C FFI layer over the core crate, accessed via cgo.

Go application code
|
v
aster-go package Idiomatic Go API: interfaces,
channels for streaming, context for deadlines
|
| cgo
v
libaster.so / .dylib C FFI shared library built from
the ffi/ crate
|
v
core crate (Rust) Same backend as Python binding
|
v
iroh crates

Key design decisions

  • Struct tags will replace Python's decorators: aster:"service=MyService", aster:"rpc", aster:"wire_type=ns/Type".
  • Go structs are the natural equivalent of Python dataclasses for wire types.
  • Apache Fory Go will handle XLANG serialization for wire compatibility with the Python binding.
  • Async model will use Go channels for streaming patterns and context.Context for deadline propagation and cancellation.
  • cgo provides the FFI bridge. The Go binding will manage the lifecycle of Rust-allocated resources through the C FFI's handle-based API.

Requirements

  • Go 1.21+.
  • A C compiler (for cgo).
  • The libaster native library for the target platform.

Further reading