2626//! enable complete control over these details if needed.
2727//!
2828//! [1]: crate::servers::ConversionWebhookServer
29+ use std:: net:: { IpAddr , Ipv4Addr , SocketAddr } ;
30+
31+ use :: x509_cert:: Certificate ;
2932use axum:: { Router , routing:: get} ;
3033use futures_util:: { FutureExt as _, pin_mut, select} ;
3134use snafu:: { ResultExt , Snafu } ;
@@ -35,19 +38,16 @@ use tokio::{
3538 sync:: mpsc,
3639} ;
3740use tower:: ServiceBuilder ;
38- use x509_cert:: Certificate ;
3941
40- // use tower_http::trace::TraceLayer;
42+ // Selected re-exports
43+ pub use crate :: options:: WebhookOptions ;
4144use crate :: tls:: TlsServer ;
4245
43- pub mod constants ;
46+ pub mod maintainer ;
4447pub mod options;
4548pub mod servers;
4649pub mod tls;
4750
48- // Selected re-exports
49- pub use crate :: options:: WebhookOptions ;
50-
5151/// A generic webhook handler receiving a request and sending back a response.
5252///
5353/// This trait is not intended to be implemented by external crates and this
@@ -86,6 +86,19 @@ pub struct WebhookServer {
8686}
8787
8888impl WebhookServer {
89+ /// The default HTTPS port `8443`
90+ pub const DEFAULT_HTTPS_PORT : u16 = 8443 ;
91+ /// The default IP address [`Ipv4Addr::UNSPECIFIED`] (`0.0.0.0`) the webhook server binds to,
92+ /// which represents binding on all network addresses.
93+ //
94+ // TODO: We might want to switch to `Ipv6Addr::UNSPECIFIED)` here, as this *normally* binds to IPv4
95+ // and IPv6. However, it's complicated and depends on the underlying system...
96+ // If we do so, we should set `set_only_v6(false)` on the socket to not rely on system defaults.
97+ pub const DEFAULT_LISTEN_ADDRESS : IpAddr = IpAddr :: V4 ( Ipv4Addr :: UNSPECIFIED ) ;
98+ /// The default socket address `0.0.0.0:8443` the webhook server binds to.
99+ pub const DEFAULT_SOCKET_ADDRESS : SocketAddr =
100+ SocketAddr :: new ( Self :: DEFAULT_LISTEN_ADDRESS , Self :: DEFAULT_HTTPS_PORT ) ;
101+
89102 /// Creates a new ready-to-use webhook server.
90103 ///
91104 /// The server listens on `socket_addr` which is provided via the [`WebhookOptions`] and handles
0 commit comments