n0-computer / n0-computer/irpc

Make it possible to have stateful connections

Open
#60 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
57
Forks
10
PR merge metrics
No merged PRs in 30d

Description

A typical usecase involves authenticating to a remote server.

I first thought this would be easy enough: See this example https://github.com/n0-computer/irpc/blob/main/irpc-iroh/examples/auth.rs

There's a Auth message that contains whatever authentication token you are using. The server expects the first message on a connection to be that message, and aborts the connection if not or if the token doesn't verify. From the server side, all is good.

On the client side however, it seems to be fine to just issue an Auth rpc call when constructing a client. However, it is not: the RemoteConnection impls for both irpc over quic and irpc-iroh support reconnects-on-demand: If the previous connection was aborted by the server in-between (e.g. because the server was restarted), irpc will reconnect to the server with the same args (alpn and node addr) than in the initial connection. The request submitted by the application will then be sent on the new connection - which will fail, because the server expects an Auth message as the first message on each connection.

It is currently completely invisible to the irpc::Client and application code if and when such reconnections happend, therefore there's no way currently to "send an Auth request first whenever a reconnect happens".

Fixing this is quite important to me, I have multiple uses of irpc that would need this. The only alternative currently is to send a token with each and every request, which is wasteful and cumbersome.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the auth.rs example and the RemoteConnection implementations for irpc over QUIC and irpc-iroh, then trace how irpc::Client handles reconnects. Define a connection-lifecycle mechanism for stateful setup, and verify that authentication is sent before application requests after every reconnect.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend-api-design, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.