diff --git a/src/config/parse.rs b/src/config/parse.rs index 74159a8..650a8e7 100644 --- a/src/config/parse.rs +++ b/src/config/parse.rs @@ -45,12 +45,17 @@ pub fn parse_opts(globals: &mut Globals, backends: &mut Backends) -> Result<()> }, anyhow!("Wrong port spec.") ); - let mut listen_addresses: Vec<&str> = LISTEN_ADDRESSES_V4.to_vec(); - if let Some(v) = config.listen_ipv6 { - if v { - listen_addresses.extend(LISTEN_ADDRESSES_V6.iter()); + // NOTE: when [::]:xx is bound, both v4 and v6 listeners are enabled. + let listen_addresses: Vec<&str> = match config.listen_ipv6 { + Some(true) => { + info!("Listen both IPv4 and IPv6"); + LISTEN_ADDRESSES_V6.to_vec() } - } + Some(false) | None => { + info!("Listen IPv4"); + LISTEN_ADDRESSES_V4.to_vec() + } + }; globals.listen_sockets = listen_addresses .iter() .flat_map(|x| { diff --git a/src/proxy/proxy_main.rs b/src/proxy/proxy_main.rs index 498df05..e0bdefa 100644 --- a/src/proxy/proxy_main.rs +++ b/src/proxy/proxy_main.rs @@ -99,10 +99,7 @@ where let listener_service = async { // let tcp_listener = TcpListener::bind(&self.listening_on).await?; let tcp_listener = self.try_bind_tcp_listener().await?; - info!( - "Start TCP proxy serving with HTTP request for configured host names: {:?}", - tcp_listener.local_addr()? - ); + info!("Start TCP proxy serving with HTTP request for configured host names"); while let Ok((stream, _client_addr)) = tcp_listener.accept().await { self .clone() diff --git a/src/proxy/proxy_tls.rs b/src/proxy/proxy_tls.rs index 8d7e55c..7384a03 100644 --- a/src/proxy/proxy_tls.rs +++ b/src/proxy/proxy_tls.rs @@ -12,7 +12,7 @@ where T: Connect + Clone + Sync + Send + 'static, { pub async fn cert_service(&self) { - info!("Start cert watch service for {}", self.listening_on); + info!("Start cert watch service"); loop { for (server_name, backend) in self.backends.apps.iter() { if backend.tls_cert_key_path.is_some() && backend.tls_cert_path.is_some() { @@ -29,10 +29,7 @@ where pub async fn listener_service(&self, server: Http) -> Result<()> { // let tcp_listener = TcpListener::bind(&self.listening_on).await?; let tcp_listener = self.try_bind_tcp_listener().await?; - info!( - "Start TCP proxy serving with HTTPS request for configured host names: {:?}", - tcp_listener.local_addr()? - ); + info!("Start TCP proxy serving with HTTPS request for configured host names"); loop { select! { @@ -102,10 +99,7 @@ where let (endpoint, incoming) = self.try_bind_quic_listener(server_config_h3).await?; // quinn::Endpoint::server(server_config_h3, self.listening_on).unwrap(); - info!( - "Start UDP proxy serving with HTTP/3 request for configured host names: {:?}", - endpoint.local_addr()? - ); + info!("Start UDP proxy serving with HTTP/3 request for configured host names"); let mut p = incoming.peekable(); loop {