Skip to content

Commit e465899

Browse files
committed
Refactor module into and relocate the no-op tls module
1 parent d8f3ffa commit e465899

19 files changed

Lines changed: 837 additions & 16 deletions

File tree

.bleep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b01a9bc71ff892b2fdbb47f6bb3f9eac88907435
1+
aadd07a5b3064b0fbdf57c8c02a5ef7b65b5fc03

pingora-core/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ jemallocator = "0.5"
7979

8080
[features]
8181
default = ["openssl"]
82-
openssl = ["pingora-openssl"]
83-
boringssl = ["pingora-boringssl"]
84-
patched_http1 = []
82+
openssl = ["pingora-openssl", "some_tls"]
83+
boringssl = ["pingora-boringssl", "some_tls"]
84+
patched_http1 = []
85+
some_tls = []

pingora-core/src/connectors/http/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ impl Connector {
9595
}
9696

9797
#[cfg(test)]
98+
#[cfg(feature = "some_tls")]
9899
mod tests {
99100
use super::*;
100101
use crate::protocols::http::v1::client::HttpSession as Http1Session;

pingora-core/src/connectors/http/v1.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ mod tests {
103103
}
104104

105105
#[tokio::test]
106+
#[cfg(feature = "some_tls")]
106107
async fn test_connect_tls() {
107108
let connector = Connector::new(None);
108109
let peer = HttpPeer::new(("1.1.1.1", 443), true, "one.one.one.one".into());

pingora-core/src/connectors/http/v2.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ mod tests {
460460
use crate::upstreams::peer::HttpPeer;
461461

462462
#[tokio::test]
463+
#[cfg(feature = "some_tls")]
463464
async fn test_connect_h2() {
464465
let connector = Connector::new(None);
465466
let mut peer = HttpPeer::new(("1.1.1.1", 443), true, "one.one.one.one".into());
@@ -472,6 +473,7 @@ mod tests {
472473
}
473474

474475
#[tokio::test]
476+
#[cfg(feature = "some_tls")]
475477
async fn test_connect_h1() {
476478
let connector = Connector::new(None);
477479
let mut peer = HttpPeer::new(("1.1.1.1", 443), true, "one.one.one.one".into());
@@ -497,6 +499,7 @@ mod tests {
497499
}
498500

499501
#[tokio::test]
502+
#[cfg(feature = "some_tls")]
500503
async fn test_h2_single_stream() {
501504
let connector = Connector::new(None);
502505
let mut peer = HttpPeer::new(("1.1.1.1", 443), true, "one.one.one.one".into());
@@ -528,6 +531,7 @@ mod tests {
528531
}
529532

530533
#[tokio::test]
534+
#[cfg(feature = "some_tls")]
531535
async fn test_h2_multiple_stream() {
532536
let connector = Connector::new(None);
533537
let mut peer = HttpPeer::new(("1.1.1.1", 443), true, "one.one.one.one".into());

pingora-core/src/connectors/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ fn test_reusable_stream(stream: &mut Stream) -> bool {
365365
}
366366

367367
#[cfg(test)]
368+
#[cfg(feature = "some_tls")]
368369
mod tests {
369370
use pingora_error::ErrorType;
370371

pingora-core/src/connectors/tls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use pingora_error::{Error, ErrorType::*, OrErr, Result};
1717
use std::sync::{Arc, Once};
1818

1919
use super::ConnectorOptions;
20-
use crate::protocols::ssl::client::handshake;
21-
use crate::protocols::ssl::SslStream;
20+
use crate::protocols::tls::client::handshake;
21+
use crate::protocols::tls::SslStream;
2222
use crate::protocols::IO;
2323
use crate::tls::ext::{
2424
add_host, clear_error_stack, ssl_add_chain_cert, ssl_set_groups_list,

pingora-core/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ pub use pingora_boringssl as tls;
5858
#[cfg(all(not(feature = "boringssl"), feature = "openssl"))]
5959
pub use pingora_openssl as tls;
6060

61-
#[cfg(all(not(feature = "boringssl"), not(feature = "openssl")))]
62-
pub mod tls;
61+
#[cfg(not(feature = "some_tls"))]
62+
pub use protocols::tls::dummy_tls as tls;
6363

6464
pub mod prelude {
6565
pub use crate::server::configuration::Opt;

pingora-core/src/listeners/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use std::{fs::Permissions, sync::Arc};
2626
use l4::{ListenerEndpoint, Stream as L4Stream};
2727
use tls::Acceptor;
2828

29-
pub use crate::protocols::ssl::server::TlsAccept;
29+
pub use crate::protocols::tls::server::TlsAccept;
3030
pub use l4::{ServerAddress, TcpSocketOptions};
3131
pub use tls::{TlsSettings, ALPN};
3232

@@ -213,6 +213,7 @@ mod test {
213213
}
214214

215215
#[tokio::test]
216+
#[cfg(feature = "some_tls")]
216217
async fn test_listen_tls() {
217218
use tokio::io::AsyncReadExt;
218219

pingora-core/src/listeners/tls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ use log::debug;
1616
use pingora_error::{ErrorType, OrErr, Result};
1717
use std::ops::{Deref, DerefMut};
1818

19-
use crate::protocols::ssl::{
19+
use crate::protocols::tls::{
2020
server::{handshake, handshake_with_callback, TlsAcceptCallbacks},
2121
SslStream,
2222
};
2323
use crate::protocols::IO;
2424
use crate::tls::ssl::{SslAcceptor, SslAcceptorBuilder, SslFiletype, SslMethod};
2525

26-
pub use crate::protocols::ssl::ALPN;
26+
pub use crate::protocols::tls::ALPN;
2727

2828
pub const TLS_CONF_ERR: ErrorType = ErrorType::Custom("TLSConfigError");
2929

0 commit comments

Comments
 (0)