How to get server address of TLS server #2329
Unanswered
JoelSatkas
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I have a look at their docs and indeed couldn't find a way to get the address of a |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I followed the example of implementing a TLS server in axum: https://github.com/tokio-rs/axum/blob/main/examples/tls-graceful-shutdown/src/main.rs and adapted the code to my project but now i would like it that this https server asks the OS to just take the next available port number and then print to the console what this port number is so that its accessible.
This is possible to do for the http redirect server because it uses the hyper builder directly. This is how you can get axum to dynamically assign a port number adn then print to console:
But i also want to do this as well for the https server from which as i understand it, is not possible. And the given example would even be wrong if provided a port number of 0 because the OS would actually assign a different port number but 0 would be printed in this tracing log.
Is it possible to do it at all?
Beta Was this translation helpful? Give feedback.
All reactions