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

scr-axum-cranker-router

A Rust port of mu-cranker-router

3 releases

0.0.4 Oct 23, 2024
0.0.3 Sep 26, 2024
0.0.2 Jun 2, 2024
0.0.1 Jun 1, 2024

#1164 in Network programming

Download history 174/week @ 2024-09-23 44/week @ 2024-09-30 12/week @ 2024-10-07 130/week @ 2024-10-21 2/week @ 2024-10-28

133 downloads per month

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
~323K SLoC