Skip to content

Commit

Permalink
move QueryAnswerCertificate::Domain to ResponseContent::CertificatesB…
Browse files Browse the repository at this point in the history
…yDomain
  • Loading branch information
Keksoj committed Mar 22, 2023
1 parent 3387628 commit 30ae223
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions bin/src/ctl/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ impl CommandManager {
| ResponseContent::ClustersHashes(_)
| ResponseContent::Clusters(_)
| ResponseContent::Certificates(_)
| ResponseContent::CertificatesByDomain(_)
| ResponseContent::AllCertificates(_)
| ResponseContent::AvailableMetrics(_)
| ResponseContent::Event(_) => {}
Expand Down
2 changes: 1 addition & 1 deletion bin/src/ctl/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ pub fn print_certificates(
println!();
}
}
ResponseContent::Certificates(QueryAnswerCertificate::Domain(h)) => {
ResponseContent::CertificatesByDomain(h) => {
for (addr, opt) in h.iter() {
println!("\t{addr}:");
if let Some((key, fingerprint)) = opt {
Expand Down
5 changes: 5 additions & 0 deletions command/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ pub enum ResponseContent {

/// returns a list of certificates: domain -> fingerprint
AllCertificates(HashMap<SocketAddr, BTreeMap<String, Vec<u8>>>),

/// returns certificates matching a certificate request by domain
CertificatesByDomain(HashMap<SocketAddr, Option<(String, Vec<u8>)>>),
}

#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
Expand All @@ -97,8 +100,10 @@ pub struct QueryAnswerCluster {

#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum QueryAnswerCertificate {
/*
/// returns a fingerprint
Domain(HashMap<SocketAddr, Option<(String, Vec<u8>)>>),
*/
/// returns the certificate
Fingerprint(Option<(String, Vec<String>)>),
}
Expand Down
9 changes: 2 additions & 7 deletions lib/src/https.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,7 @@ use crate::{
AddCertificate, Cluster, QueryCertificateType, RemoveCertificate, RemoveListener,
ReplaceCertificate, Request, WorkerRequest,
},
response::{
HttpFrontend, HttpsListenerConfig, QueryAnswerCertificate, ResponseContent, Route,
WorkerResponse,
},
response::{HttpFrontend, HttpsListenerConfig, ResponseContent, Route, WorkerResponse},
scm_socket::ScmSocket,
state::ClusterId,
},
Expand Down Expand Up @@ -987,9 +984,7 @@ impl HttpsProxy {
domain, certificates
);

Ok(Some(ResponseContent::Certificates(
QueryAnswerCertificate::Domain(certificates),
)))
Ok(Some(ResponseContent::CertificatesByDomain(certificates)))
}

pub fn activate_listener(
Expand Down

0 comments on commit 30ae223

Please sign in to comment.