examples: add allowlist example #19

Merged
decentral1se merged 3 commits from examples-allowlist into main 2026-10-14 10:59:56 +00:00
Collaborator

Adding the allowlist example we chatted about! It is basically timeserve with an allowlist controlling what peer can actually make a connection and be served the time. I use a simple string (-allow <endpointid>) as an allowlist of size one since that is easier for trying things out, but the same logic can trivially be expanded to a list greater than 1.

It's both simple (just checking one string, EndpointId.String(), against a set of allowlisted strings, -allow <string> in the current example) while also having a little bit of intricacy around when we can detect the remote endpoint id (is it being relayed? is it a direct connection?) as well as what type of errors are sent when. Having worked through this example I've at least convinced myself that the existing iroh functionality is good enough for implementing an allowlist in me own iroh-go-using app!

Lemme know if you have any Q's or thoughts 🙇

p.s. also contains a bonus of demonstrating how to setup static identities (-secret <str> + setting opts.SecretKey) and how to work with iroh's tickets (needed tickets to try out non-relayed direct connections with PresetN0DisableRelay, as they encode a peer's IP)

Adding the allowlist example we chatted about! It is basically `timeserve` with an allowlist controlling what peer can actually make a connection and be served the time. I use a simple string (`-allow <endpointid>`) as an allowlist of size one since that is easier for trying things out, but the same logic can trivially be expanded to a list greater than 1. It's both simple (just checking one string, `EndpointId.String()`, against a set of allowlisted strings, `-allow <string>` in the current example) while also having a little bit of intricacy around when we can detect the remote endpoint id (is it being relayed? is it a direct connection?) as well as what type of errors are sent when. Having worked through this example I've at least convinced myself that the existing iroh functionality is good enough for implementing an allowlist in me own `iroh-go`-using app! Lemme know if you have any Q's or thoughts 🙇 p.s. also contains a bonus of demonstrating how to setup static identities (`-secret <str>` + setting `opts.SecretKey`) and how to work with iroh's tickets (needed tickets to try out non-relayed direct connections with `PresetN0DisableRelay`, as they encode a peer's IP)
cblgh added 1 commit 2026-10-13 12:46:27 +00:00
cblgh added 1 commit 2026-10-13 13:50:54 +00:00
cblgh added 1 commit 2026-10-14 07:16:11 +00:00
examples: readme - add tickets doc
continuous-integration/drone/push Build is passing
0d4253b271
cblgh force-pushed examples-allowlist from 9a620897d3 to 0d4253b271 2026-10-14 07:16:11 +00:00 Compare
decentral1se left a comment
Owner

SO cool 🌟

SO cool 🌟
decentral1se merged commit d2a892d543 into main 2026-10-14 10:59:56 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: decentral1se/iroh-go#19