#reverse-proxy #http-router #websocket #router #http #cranker

scr-axum-cranker-router

A Rust port of mu-cranker-router

3 releases

new 0.0.5 Dec 5, 2024
0.0.4 Oct 23, 2024
0.0.3 Sep 26, 2024
0.0.2 Jun 2, 2024
0.0.1 Jun 1, 2024

#1310 in Network programming

Apache-2.0

250KB
5K SLoC

scr-axum-cranker-router

A Rust port of mu-cranker-router

"scr" means from scratch, there was a "cranker-ruster" previously when Rust was too hard for me. Rust is still too hard, but it's not so painful now, that's why this one is written from scratch again.

TODO

  • Replace VecDeque with a timeout-able mpsc channel for polling router socket
  • [ ] Define errors with thiserror crate Current approach should be adequate.
  • [ ] Wrap the whole thing into a tower service Looks like tower http not designed for WebSocket so no way
  • V3 support
  • Handle invalid router socket
  • Invoke listeners at hooking point Invoke on_failure_to_acquire_proxy_socket in ProxyListener
  • Add health map for observability. To achieve this we need to change the current Arc<dyn RouteSocket> in route_to_socket_chan to Weak<_>, and store the only Arc in a global map in the AppState. Reference WebSocketFarm in mu cranker router. WebSocketFarm done. The /health/connectors is available by default.
  • Deregister handler
  • [ ] Replace all unnecessary async mpmc unbounded channel with tokio's mpsc unbounded channel. Abandoned.
  • Dark mode manager
  • Tidy up access modifiers, expose as little implementation details as possible.
  • Consider tracing crate for logging
  • Get rid of the rfc7239 crate which has bug in parsing host with port
  • Documentation. Migrate from java doc for all public available code.
  • Graceful shutdown. Check simple_v1.

Dependencies

~12–22MB
~312K SLoC