Repository navigation
Conversation
Signed-off-by: Eloi DEMOLIS <[email protected]>
Keksoj
left a comment
There was a problem hiding this comment.
since it works, I trust the code. I only have cosmetic comments to make
| Some(State::Pipe(ref mut pipe)) => pipe.writable(&mut self.metrics), | ||
| Some(State::PipeTls(ref mut pipe)) => pipe.writable(&mut self.metrics), | ||
| Some(State::Handshake(ref mut handshake)) => { | ||
| let (upgrade, result) = handshake.writable(); |
There was a problem hiding this comment.
please rename result to session_result for understandability.
| gauge_add!("protocol.proxy.send", -1); | ||
| gauge_add!("protocol.tcp", 1); | ||
| UpgradeResult::Continue | ||
| } else { |
There was a problem hiding this comment.
an early return with the error case would be preferable here, for a better reading flow
| gauge_add!("protocol.proxy.relay", -1); | ||
| gauge_add!("protocol.tcp", 1); | ||
| UpgradeResult::Continue | ||
| } else { |
There was a problem hiding this comment.
same thing, return early in case of error
| gauge_add!("protocol.proxy.expect", -1); | ||
| gauge_add!("protocol.tcp", 1); | ||
| UpgradeResult::ConnectBackend | ||
| } else { |
| if let Some(State::Handshake(_)) = self.protocol { | ||
| } else { | ||
| match self.connect_to_backend(session.clone()) { | ||
| // reuse connection or error we can continue | ||
| Ok(BackendConnectAction::Reuse) | Err(_) => {} | ||
| // New or Replace: stop here, we must wait for an event | ||
| _ => return SessionResult::Continue, | ||
| } | ||
| } |
There was a problem hiding this comment.
| if let Some(State::Handshake(_)) = self.protocol { | |
| } else { | |
| match self.connect_to_backend(session.clone()) { | |
| // reuse connection or error we can continue | |
| Ok(BackendConnectAction::Reuse) | Err(_) => {} | |
| // New or Replace: stop here, we must wait for an event | |
| _ => return SessionResult::Continue, | |
| } | |
| } | |
| match self.protocol { | |
| Some(State::Handshake(_)) => {}, // do nothing | |
| _ => { | |
| match self.connect_to_backend(session.clone()) { | |
| // reuse connection or error we can continue | |
| Ok(BackendConnectAction::Reuse) | Err(_) => {} | |
| // New or Replace: stop here, we must wait for an event | |
| _ => return SessionResult::Continue, | |
| } | |
| } |
| token: Token, | ||
| ) -> Result<Listener, rustls::Error> { | ||
| let server_config = ServerConfig::builder(); | ||
| let ssl_config = if let Some(ref tls) = config.tls { |
| let mut key_reader = BufReader::new(tls.key.as_ref().unwrap().as_bytes()); | ||
| let mut key_res = None; | ||
| let parsed_keys = rustls_pemfile::rsa_private_keys(&mut key_reader); | ||
| if let Ok(mut keys) = parsed_keys { |
| } else { | ||
| let mut key_reader = BufReader::new(tls.key.as_ref().unwrap().as_bytes()); | ||
| let parsed_keys = rustls_pemfile::pkcs8_private_keys(&mut key_reader); | ||
| if let Ok(mut keys) = parsed_keys { |
Signed-off-by: Eloi DEMOLIS <[email protected]>
Signed-off-by: Eloi DEMOLIS <[email protected]>
|
It still lacks OpenSSL support and SNI dispatching: ignore no But it becomes apparent that this may not be the cleanest implementation. Validating the config is difficult, it is not possible to have both HTTPS and TCPS listeners on the same frontend, and a lot of code duplication is needed. The TCP proxy becomes cluttered by a lot of TLS logic copy-pasted both from openssl and rustls proxies (mainly for configuration and certificate handling). TCP Listeners hold logic for a 3 branches switch (plaintext, openssl, rustls). more thoughts here #826 |
|
I moved this into the HTTP2 milestone, since it's part of the conversation we have over there. I suggest we close this merge request since we moved on to other plans. |
TODO:
Signed-off-by: Eloi DEMOLIS [email protected]