DioxusLabs / DioxusLabs/dioxus
Expose connection info in fullstack
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
## Feature Request
I wanted to access the client's IP address within a server function. Axum provides this info via the [ConnectInfo](https://docs.rs/axum/0.8.8/axum/extract/connect_info/struct.ConnectInfo.html) extractor.
However, that requires calling [`.into_make_service_with_connect_info::()`](https://docs.rs/axum/0.8.8/axum/struct.Router.html#method.into_make_service_with_connect_info).
Dioxus only calls `.into_make_service`.
https://github.com/DioxusLabs/dioxus/blob/f717a8e184a522d078b70bb4b4d62a5f9a99ddfc/packages/fullstack-server/src/launch.rs#L147
https://github.com/DioxusLabs/dioxus/blob/f717a8e184a522d078b70bb4b4d62a5f9a99ddfc/packages/fullstack-server/src/launch.rs#L161
## Implement Suggestion
`serve_router` should accept the same type as `axum::serve`
## Additional info
Accessing a client's IP address has a lot of use-cases. Mine is checking which VPN client it is, as VPNs like Tailscale and Wireshark guarantee static IP addresses for the clients.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in packages/fullstack-server/src/launch.rs at the two linked locations, and compare the current .into_make_service usage with Axum's axum::serve and .into_make_service_with_connect_info::(). Trace how serve_router is defined and called. Done means server functions can access client connection information, including a client's IP address, without breaking existing fullstack server startup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100