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

scr-axum-cranker-router

A Rust port of mu-cranker-router

1 unstable release

new 0.0.2 Jun 2, 2024
0.0.1 Jun 1, 2024

#1738 in Network programming

Download history 93/week @ 2024-05-26

104 downloads per month

Apache-2.0

245KB
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

~13–24MB
~339K SLoC