-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(iroh-net)!: Improve server modules structure & rename structs #2568
Conversation
5521564
to
9ac0be6
Compare
d38a4ac
to
88c3019
Compare
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/2568/docs/iroh/ Last updated: 2024-07-31T09:13:09Z |
//! based on tailscale/derp/derp_client.go | ||
use std::net::SocketAddr; | ||
use std::pin::Pin; | ||
//! Based on tailscale/derp/derphttp/derphttp_client.go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see, the diff here is fucked 😬
I moved relay/http/client.rs
to here, and moved the old relay/client.rs
to relay/client/conn.rs
.
I also renamed a bunch of the Client*
things to Conn*
, which probably made this diff look bad.
iroh-net/src/relay/server.rs
Outdated
//! based on tailscale/derp/derp_server.go | ||
use std::collections::HashMap; | ||
//! A full-fledged iroh-relay server. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, the diff here ended up bad. I think it may actually be due to the fact that I've moved this module somewhere else while simultaneously moving something else to here :/
#[cfg(test)] | ||
mod tests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved these tests to here from relay/http.rs
, as that module mainly included types and constants, not the code.
There's some small unused things remaining. Will update the PR tomorrow morning ✌️ In the mean time - I've written up some notes in the PR description. |
seems mostly fine from my side, @ramfox is the master of this code though, so she will have to deliver final verdict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, went through this. Looks good. I especially like the rename from Client
to Conn
. I think client::Conn
and server::ClientConn
mirror each other better now. It makes it a bit more clear that the server::ClientConn
is the server-side driver of the connection to the client.
Approved! Nice work! Happy to re-review on the last bits of clean up when you need it.
Current state of this is: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice restructure!
looking forward to merging this into the quinn11 branch 🙃
…ay::server::service` to `relay::server`
…rs` one level up
f19fcc7
to
6c818cb
Compare
Description
This is moving around the relay modules a bit. Mostly so that all server-specific code is under
iroh-net/src/relay/server/
.This means there's only a handful of
#[cfg(feature = "iroh-relay")]
s inrelay.rs
and a bunch of other places due to unused warnings otherwise.I've also renamed what was previously
iroh::relay::client::{Client, ClientBuilder, ClientReceiver, ...}
toiroh::relay::client::conn::{Conn, ConnBuilder, ConnReceiver, ...}
, because otherwise theClient*
names were duplicated in two modules that were in a parent-child relationship, which is super confusing.And really, the inner
Client
s are more about individual connections.I also resolved a TODO around moving to an
AbortingJoinHandle
in favor of a customRelayHttpServerGuard
.Breaking Changes
iroh-relay
feature in iroh-netiroh_net::relay::iroh_relay::*
toiroh_net::relay::server::*
iroh_net::relay::ClientConnHandler
toiroh_net::relay::server::ClientConnHandler
iroh_net::relay::Metrics
toiroh_net::relay::server::Metrics
iroh_net::relay::MaybeTlsStreamServer
toiroh_net::relay::server::MaybeTlsStreamServer
iroh_net::relay::http::ServerHandle
. The server can now be aborted via itstask_handle()
function or by dropping it.iroh_net::relay::RelayClient
toiroh_net::relay::RelayConn
iroh_net::relay::http::Client
toiroh_net::relay::HttpClient
iroh_net::relay::http::ClientBuilder
toiroh_net::relay::HttpClientBuilder
iroh_net::relay::http::ClientReceiver
toiroh_net::relay::HttpClientReceiver
iroh_net::relay::http::ClientError
toiroh_net::relay::HttpClientError
iroh_net::relay::http::TlsConfig
toiroh_net::relay::server::TlsConfig
iroh_net::relay::Server
toiroh_net::relay::server::ServerActorTask
iroh_net::relay::http::{Server, ServerBuilder}
. Useiroh_net::relay::server::Server
instead.#[cfg(feature = "iroh-relay")]
by feature-gating the wholeiroh_net::relay::server
module.Notes & open questions
I realize the diff here is quite substantial. Unfortunately the diff is mostly just bad because I ended up "swapping places" for modules in two cases, which ended up creating really bad diffs.
I know the diff is quite sad, so it's fair if we say "this is unreviewable" and I scrap this piece of work. I'm not blocked on this merging, and I only fairly quickly knocked this out today.
As Mark Twain famously said
Or sth like that.
Change checklist
[ ] Tests if relevant.