From 2b8ef6a15ca91bd381ea96f8292da59037385aaa Mon Sep 17 00:00:00 2001 From: decentral1se Date: Fri, 13 Nov 2026 18:50:18 +0100 Subject: [PATCH 1/3] feat: jasmine teehaus --- .gitignore | 1 + endpoint/endpoint.go | 13 ++++++ examples/jasmine-teehaus/README.md | 5 +++ examples/jasmine-teehaus/go.mod | 12 ++++++ examples/jasmine-teehaus/go.sum | 6 +++ examples/jasmine-teehaus/jasmineteehaus.go | 50 ++++++++++++++++++++++ examples/jasmine-teehaus/makefile | 2 + 7 files changed, 89 insertions(+) create mode 100644 examples/jasmine-teehaus/README.md create mode 100644 examples/jasmine-teehaus/go.mod create mode 100644 examples/jasmine-teehaus/go.sum create mode 100644 examples/jasmine-teehaus/jasmineteehaus.go create mode 100644 examples/jasmine-teehaus/makefile diff --git a/.gitignore b/.gitignore index 352e02c..b07865f 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ examples/echosrv/echosrv examples/errors/errors examples/http-dialer/http-client examples/http-dialer/http-dialer +examples/jasmine-teehaus/jasmineteehaus examples/pairchat/pairchat examples/simple-pipe/simple-pipe examples/timeserve/timeserve diff --git a/endpoint/endpoint.go b/endpoint/endpoint.go index 051d55f..22d3e17 100644 --- a/endpoint/endpoint.go +++ b/endpoint/endpoint.go @@ -6,6 +6,7 @@ import ( "os" iroh "git.coopcloud.tech/decentral1se/iroh-go" + jt "gomod.cblgh.org/jasmine-teehaus/experimental" ) type Option func(*iroh.EndpointBuilder) error @@ -61,6 +62,18 @@ func WithApplyMinimal() Option { } } +func WithApplyJasmineTeehaus() Option { + return func(endpointBuilder *iroh.EndpointBuilder) error { + endpointBuilder.ApplyN0DisableRelay() + relay, err := iroh.RelayModeCustomFromUrls(jt.GetAddresses(jt.GetRelays(jt.MAJOR_V1))) + if err != nil { + return err + } + endpointBuilder.RelayMode(relay) + return nil + } +} + func WithRelayMode(rMode *iroh.RelayMode) Option { return func(endpointBuilder *iroh.EndpointBuilder) error { endpointBuilder.RelayMode(rMode) diff --git a/examples/jasmine-teehaus/README.md b/examples/jasmine-teehaus/README.md new file mode 100644 index 0000000..68b938f --- /dev/null +++ b/examples/jasmine-teehaus/README.md @@ -0,0 +1,5 @@ +# jasmine-teehaus + +This example shows how to configure the community managed relays of +[`jasmine-teehaus`](https://codeberg.org/cblgh/jasmine-teehaus). This approach +should generally work for other community relays. diff --git a/examples/jasmine-teehaus/go.mod b/examples/jasmine-teehaus/go.mod new file mode 100644 index 0000000..4a04ca4 --- /dev/null +++ b/examples/jasmine-teehaus/go.mod @@ -0,0 +1,12 @@ +module git.coopcloud.tech/decentral1se/iroh-go/examples/jasmineteehaus + +go 1.26.1 + +require git.coopcloud.tech/decentral1se/iroh-go v0.0.0-20260717110820-68ad06fe2a25 + +require ( + golang.org/x/sync v0.24.0 // indirect + gomod.cblgh.org/jasmine-teehaus v0.0.3 // indirect +) + +replace git.coopcloud.tech/decentral1se/iroh-go => ../../ diff --git a/examples/jasmine-teehaus/go.sum b/examples/jasmine-teehaus/go.sum new file mode 100644 index 0000000..3a23bc1 --- /dev/null +++ b/examples/jasmine-teehaus/go.sum @@ -0,0 +1,6 @@ +github.com/magiconair/properties v1.18.12 h1:sT9zQpvTB3B4gzrX0tmZNTEaGyg8Zw55MFYRE32Mr9I= +github.com/magiconair/properties v1.18.12/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +gomod.cblgh.org/jasmine-teehaus v0.0.3 h1:KXdEcJeAo7TqNq98UtPJ/OzmteVuaaoMWy7LK1wZMy4= +gomod.cblgh.org/jasmine-teehaus v0.0.3/go.mod h1:kga45IfEn1aEX2VPxQ8yXA3VcqyDseTIdf68gpWQtrM= diff --git a/examples/jasmine-teehaus/jasmineteehaus.go b/examples/jasmine-teehaus/jasmineteehaus.go new file mode 100644 index 0000000..d4c4f94 --- /dev/null +++ b/examples/jasmine-teehaus/jasmineteehaus.go @@ -0,0 +1,50 @@ +package main + +import ( + iroh "git.coopcloud.tech/decentral1se/iroh-go" + "git.coopcloud.tech/decentral1se/iroh-go/endpoint" + jt "gomod.cblgh.org/jasmine-teehaus/experimental" +) + +func main() { + alpn := iroh.Alpn("iroh-go-jt/0") + + // Using the endpoint builder approach + e1, err := endpoint.New( + endpoint.WithAlpns(alpn), + endpoint.WithApplyJasmineTeehaus(), + ) + if err := iroh.As(err); err != nil { + panic(err) + } + + e1.Online() + + if err := e1.Close(); err != nil { + panic(iroh.As(err)) + } + + // Using the endpoint bind approach + preset := iroh.PresetN0DisableRelay() + relay, err := iroh.RelayModeCustomFromUrls(jt.GetAddresses(jt.GetRelays(jt.MAJOR_V1))) + if err := iroh.As(err); err != nil { + panic(err) + } + + opts := iroh.EndpointOptions{ + Preset: &preset, + Alpns: &[][]byte{alpn}, + RelayMode: &relay, + } + + e2, err := iroh.EndpointBind(opts) + if err := iroh.As(err); err != nil { + panic(err) + } + + e2.Online() + + if err := e2.Close(); err != nil { + panic(iroh.As(err)) + } +} diff --git a/examples/jasmine-teehaus/makefile b/examples/jasmine-teehaus/makefile new file mode 100644 index 0000000..aa931af --- /dev/null +++ b/examples/jasmine-teehaus/makefile @@ -0,0 +1,2 @@ +default: + @go build -v ./... -- 2.54.0 From 898f23ed0bca6b396a8f1cf6a624fde40d160e6c Mon Sep 17 00:00:00 2001 From: decentral1se Date: Fri, 13 Nov 2026 18:51:52 +0100 Subject: [PATCH 2/3] fix: go mod tidy --- examples/cleanclose/go.mod | 5 ++++- examples/cleanclose/go.sum | 4 ++++ examples/withcontext/go.mod | 5 ++++- examples/withcontext/go.sum | 4 ++++ go.mod | 1 + go.sum | 2 ++ 6 files changed, 19 insertions(+), 2 deletions(-) diff --git a/examples/cleanclose/go.mod b/examples/cleanclose/go.mod index 2c1d062..9bbbd7b 100644 --- a/examples/cleanclose/go.mod +++ b/examples/cleanclose/go.mod @@ -4,6 +4,9 @@ go 1.26.1 require git.coopcloud.tech/decentral1se/iroh-go v0.0.0-20260717110820-68ad06fe2a25 -require golang.org/x/sync v0.24.0 // indirect +require ( + golang.org/x/sync v0.24.0 // indirect + gomod.cblgh.org/jasmine-teehaus v0.0.3 // indirect +) replace git.coopcloud.tech/decentral1se/iroh-go => ../../ diff --git a/examples/cleanclose/go.sum b/examples/cleanclose/go.sum index 76e6342..3a23bc1 100644 --- a/examples/cleanclose/go.sum +++ b/examples/cleanclose/go.sum @@ -1,2 +1,6 @@ +github.com/magiconair/properties v1.18.12 h1:sT9zQpvTB3B4gzrX0tmZNTEaGyg8Zw55MFYRE32Mr9I= +github.com/magiconair/properties v1.18.12/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +gomod.cblgh.org/jasmine-teehaus v0.0.3 h1:KXdEcJeAo7TqNq98UtPJ/OzmteVuaaoMWy7LK1wZMy4= +gomod.cblgh.org/jasmine-teehaus v0.0.3/go.mod h1:kga45IfEn1aEX2VPxQ8yXA3VcqyDseTIdf68gpWQtrM= diff --git a/examples/withcontext/go.mod b/examples/withcontext/go.mod index 8f0d416..ed5d451 100644 --- a/examples/withcontext/go.mod +++ b/examples/withcontext/go.mod @@ -4,6 +4,9 @@ go 1.26.1 require git.coopcloud.tech/decentral1se/iroh-go v0.0.0-20260717110820-68ad06fe2a25 -require golang.org/x/sync v0.24.0 // indirect +require ( + golang.org/x/sync v0.24.0 // indirect + gomod.cblgh.org/jasmine-teehaus v0.0.3 // indirect +) replace git.coopcloud.tech/decentral1se/iroh-go => ../../ diff --git a/examples/withcontext/go.sum b/examples/withcontext/go.sum index 76e6342..3a23bc1 100644 --- a/examples/withcontext/go.sum +++ b/examples/withcontext/go.sum @@ -1,2 +1,6 @@ +github.com/magiconair/properties v1.18.12 h1:sT9zQpvTB3B4gzrX0tmZNTEaGyg8Zw55MFYRE32Mr9I= +github.com/magiconair/properties v1.18.12/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +gomod.cblgh.org/jasmine-teehaus v0.0.3 h1:KXdEcJeAo7TqNq98UtPJ/OzmteVuaaoMWy7LK1wZMy4= +gomod.cblgh.org/jasmine-teehaus v0.0.3/go.mod h1:kga45IfEn1aEX2VPxQ8yXA3VcqyDseTIdf68gpWQtrM= diff --git a/go.mod b/go.mod index 5aac5e4..3598ca4 100644 --- a/go.mod +++ b/go.mod @@ -5,4 +5,5 @@ go 1.26.1 require ( github.com/magiconair/properties v1.18.12 golang.org/x/sync v0.24.0 + gomod.cblgh.org/jasmine-teehaus v0.0.3 ) diff --git a/go.sum b/go.sum index 30d2e10..3a23bc1 100644 --- a/go.sum +++ b/go.sum @@ -2,3 +2,5 @@ github.com/magiconair/properties v1.18.12 h1:sT9zQpvTB3B4gzrX0tmZNTEaGyg8Zw55MFY github.com/magiconair/properties v1.18.12/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +gomod.cblgh.org/jasmine-teehaus v0.0.3 h1:KXdEcJeAo7TqNq98UtPJ/OzmteVuaaoMWy7LK1wZMy4= +gomod.cblgh.org/jasmine-teehaus v0.0.3/go.mod h1:kga45IfEn1aEX2VPxQ8yXA3VcqyDseTIdf68gpWQtrM= -- 2.54.0 From 880e41f8ab141191b3fdd0eef0271346755fabd7 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Fri, 13 Nov 2026 18:56:58 +0100 Subject: [PATCH 3/3] build: justfile --- CONTRIBUTING.md | 8 ++++++++ justfile | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 justfile diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e9f4d04..7bc1196 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,3 +16,11 @@ Policy](https://ziglang.org/code-of-conduct/#strict-no-llm-no-ai-policy) of though it would be more convenient to use `iroh.As` internally. This is to maintain consistency in error handling across the entire API boundary (bindings or custom). The API consumer uses `iroh.As`, not the producer. + +## Validate Changes + +We use [`just`](https://just.systems/) and `make`. The default `justfile` target runs everything. + +``` +just +``` diff --git a/justfile b/justfile new file mode 100644 index 0000000..feab931 --- /dev/null +++ b/justfile @@ -0,0 +1,7 @@ +default: build examples + +build: + @go build -v ./... + +examples: + @for ex in $(find examples -mindepth 1 -maxdepth 1 -type d -not -path "*-desktop"); do make -C $ex; done -- 2.54.0