Skip to content

Commit ad449bf

Browse files
cachpachiosNoah-Kennedy
authored andcommitted
feat: Add new_mtls for HttpProxy
Exposes a new_mtls method for creating a HttpProxy with a client_cert_key to enable mtls peers. Includes-commit: d71251e Replicated-from: #784
1 parent 3a5fdf4 commit ad449bf

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.bleep

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f6ec319eff34f641d13b5e1ac0581caad9905e98
1+
f4e5ae2d44c6e580a5a9a7cc5a80b07c69c95840

pingora-core/src/upstreams/peer.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,17 @@ impl HttpPeer {
642642
}
643643
}
644644

645+
/// Create a new [`HttpPeer`] with client certificate and key for mutual TLS.
646+
pub fn new_mtls<A: ToInetSocketAddrs>(
647+
address: A,
648+
sni: String,
649+
client_cert_key: Arc<CertKey>,
650+
) -> Self {
651+
let mut peer = Self::new(address, true, sni);
652+
peer.client_cert_key = Some(client_cert_key);
653+
peer
654+
}
655+
645656
fn peer_hash(&self) -> u64 {
646657
let mut hasher = AHasher::default();
647658
self.hash(&mut hasher);

0 commit comments

Comments
 (0)