fix listers

This commit is contained in:
Jun Kurihara 2022-07-07 17:42:20 +09:00
commit 5731ba908b
No known key found for this signature in database
GPG key ID: 48ADFD173ED22B03
3 changed files with 14 additions and 18 deletions

View file

@ -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| {

View file

@ -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()

View file

@ -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<LocalExecutor>) -> 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 {