Community relays have arrived #37
@@ -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
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 => ../../
|
||||
|
||||
@@ -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=
|
||||
|
||||
@@ -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.
|
||||
@@ -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 => ../../
|
||||
@@ -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=
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
default:
|
||||
@go build -v ./...
|
||||
@@ -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 => ../../
|
||||
|
||||
@@ -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=
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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=
|
||||
|
||||
Reference in New Issue
Block a user