Skip to content

Commit

Permalink
move QueryAnswerCertificate::Fingerprint to ResponseContent::Certific…
Browse files Browse the repository at this point in the history
…ateByFingerprint
  • Loading branch information
Keksoj committed Mar 22, 2023
1 parent 30ae223 commit 72259e7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions bin/src/ctl/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ impl CommandManager {
| ResponseContent::Clusters(_)
| ResponseContent::Certificates(_)
| ResponseContent::CertificatesByDomain(_)
| ResponseContent::CertificateByFingerprint(_)
| 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 @@ -643,7 +643,7 @@ pub fn print_certificates(
println!();
}
}
ResponseContent::Certificates(QueryAnswerCertificate::Fingerprint(opt)) => {
ResponseContent::CertificateByFingerprint(opt) => {
if let Some((s, v)) = opt {
println!("\tfrontends: {v:?}\ncertificate:\n{s}");
} else {
Expand Down
6 changes: 5 additions & 1 deletion command/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ pub enum ResponseContent {

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

/// returns the certificate matching a request by fingerprint,
/// and the list of domain names associated
CertificateByFingerprint(Option<(String, Vec<String>)>),
}

#[derive(Default, Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
Expand All @@ -103,9 +107,9 @@ pub enum QueryAnswerCertificate {
/*
/// returns a fingerprint
Domain(HashMap<SocketAddr, Option<(String, Vec<u8>)>>),
*/
/// returns the certificate
Fingerprint(Option<(String, Vec<String>)>),
*/
}

/// lists of available metrics in a worker, or in the main process (in which case there are no cluster metrics)
Expand Down
5 changes: 3 additions & 2 deletions lib/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -916,8 +916,9 @@ impl Server {
QueryCertificateType::Fingerprint(f) => {
push_queue(WorkerResponse::ok_with_content(
message.id.clone(),
ResponseContent::Certificates(QueryAnswerCertificate::Fingerprint(
get_certificate(&self.config_state, f),
ResponseContent::CertificateByFingerprint(get_certificate(
&self.config_state,
f,
)),
));
return;
Expand Down

0 comments on commit 72259e7

Please sign in to comment.