Skip to content
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

feat: local_addr for Serve and WithGracefulShutdown #2881

Merged
merged 3 commits into from
Aug 24, 2024

Conversation

JosephLenton
Copy link
Contributor

@JosephLenton JosephLenton commented Aug 18, 2024

Adds methods for exposing the address the Axum servers are bound to.

  • add Serve::local_addr, which returns the address it is bound to.
  • add WithGracefulShutdown::local_addr, which returns the address it is bound to.

Closes #2879

Motivation

I would like to be able to know the address of a server, as it makes testing code easier to write.

Solution

I have added methods to expose the SocketAddr on Serve and WithGracefulShutdown.

Adds methods for exposing the address the Axum servers are bound to.

 * add `Serve::local_addr`
 * add `WithGracefulShutdown::local_addr`

Implements tokio-rs#2879
Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, why not!

@jplatte
Copy link
Member

jplatte commented Aug 23, 2024

Could you please add a change log entry though?

@JosephLenton
Copy link
Contributor Author

@jplatte that is added!

@jplatte jplatte merged commit 1ac617a into tokio-rs:main Aug 24, 2024
18 checks passed
@JosephLenton JosephLenton deleted the feat-serve-local-addr branch August 25, 2024 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add means to find the socket address for Serve and WithGracefulShutdown
2 participants