Skip to content

Commit 0d6f577

Browse files
committed
Rename struct
1 parent 6f735f3 commit 0d6f577

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

src/attestation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ pub trait AttestationPlatform: Clone + Send + 'static {
2828
}
2929

3030
#[derive(Clone)]
31-
pub struct TdxAttestation;
31+
pub struct DcapTdxAttestation;
3232

33-
impl AttestationPlatform for TdxAttestation {
33+
impl AttestationPlatform for DcapTdxAttestation {
3434
fn is_cvm(&self) -> bool {
3535
true
3636
}

src/lib.rs

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod attestation;
22

33
use attestation::AttestationError;
4-
pub use attestation::{AttestationPlatform, NoAttestation, TdxAttestation};
4+
pub use attestation::{AttestationPlatform, DcapTdxAttestation, NoAttestation};
55
use thiserror::Error;
66
use tokio_rustls::rustls::server::{VerifierBuilderError, WebPkiClientVerifier};
77

@@ -510,7 +510,7 @@ mod tests {
510510
server_config,
511511
"127.0.0.1:0",
512512
target_addr,
513-
TdxAttestation,
513+
DcapTdxAttestation,
514514
NoAttestation,
515515
)
516516
.await
@@ -527,7 +527,7 @@ mod tests {
527527
"127.0.0.1:0".to_string(),
528528
proxy_addr.to_string(),
529529
NoAttestation,
530-
TdxAttestation,
530+
DcapTdxAttestation,
531531
None,
532532
)
533533
.await
@@ -573,8 +573,8 @@ mod tests {
573573
server_tls_server_config,
574574
"127.0.0.1:0",
575575
target_addr,
576-
TdxAttestation,
577-
TdxAttestation,
576+
DcapTdxAttestation,
577+
DcapTdxAttestation,
578578
)
579579
.await
580580
.unwrap();
@@ -589,8 +589,8 @@ mod tests {
589589
client_tls_client_config,
590590
"127.0.0.1:0",
591591
proxy_addr.to_string(),
592-
TdxAttestation,
593-
TdxAttestation,
592+
DcapTdxAttestation,
593+
DcapTdxAttestation,
594594
Some(client_cert_chain),
595595
)
596596
.await
@@ -619,7 +619,7 @@ mod tests {
619619
let (cert_chain, private_key) = generate_certificate_chain("127.0.0.1".parse().unwrap());
620620
let (server_config, client_config) = generate_tls_config(cert_chain.clone(), private_key);
621621

622-
let local_attestation_platform = TdxAttestation;
622+
let local_attestation_platform = DcapTdxAttestation;
623623

624624
let proxy_server = ProxyServer::new_with_tls_config(
625625
cert_chain,
@@ -643,7 +643,7 @@ mod tests {
643643
"127.0.0.1:0",
644644
proxy_server_addr.to_string(),
645645
NoAttestation,
646-
TdxAttestation,
646+
DcapTdxAttestation,
647647
None,
648648
)
649649
.await
@@ -670,7 +670,7 @@ mod tests {
670670
let (cert_chain, private_key) = generate_certificate_chain("127.0.0.1".parse().unwrap());
671671
let (server_config, client_config) = generate_tls_config(cert_chain.clone(), private_key);
672672

673-
let local_attestation_platform = TdxAttestation;
673+
let local_attestation_platform = DcapTdxAttestation;
674674

675675
let proxy_server = ProxyServer::new_with_tls_config(
676676
cert_chain.clone(),
@@ -689,10 +689,13 @@ mod tests {
689689
proxy_server.accept().await.unwrap();
690690
});
691691

692-
let retrieved_chain =
693-
get_tls_cert_with_config(proxy_server_addr.to_string(), TdxAttestation, client_config)
694-
.await
695-
.unwrap();
692+
let retrieved_chain = get_tls_cert_with_config(
693+
proxy_server_addr.to_string(),
694+
DcapTdxAttestation,
695+
client_config,
696+
)
697+
.await
698+
.unwrap();
696699

697700
assert_eq!(retrieved_chain, cert_chain);
698701
}

src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{fs::File, net::SocketAddr, path::PathBuf};
44
use tokio_rustls::rustls::pki_types::{CertificateDer, PrivateKeyDer};
55

66
use attested_tls_proxy::{
7-
get_tls_cert, NoAttestation, ProxyClient, ProxyServer, TdxAttestation, TlsCertAndKey,
7+
get_tls_cert, DcapTdxAttestation, NoAttestation, ProxyClient, ProxyServer, TlsCertAndKey,
88
};
99

1010
#[derive(Parser, Debug, Clone)]
@@ -84,7 +84,7 @@ async fn main() -> anyhow::Result<()> {
8484
address,
8585
server,
8686
NoAttestation,
87-
TdxAttestation,
87+
DcapTdxAttestation,
8888
)
8989
.await?;
9090

@@ -102,7 +102,7 @@ async fn main() -> anyhow::Result<()> {
102102
client_auth,
103103
} => {
104104
let tls_cert_and_chain = load_tls_cert_and_key(cert_chain, private_key)?;
105-
let local_attestation = TdxAttestation;
105+
let local_attestation = DcapTdxAttestation;
106106
let remote_attestation = NoAttestation;
107107

108108
let server = ProxyServer::new(
@@ -122,7 +122,7 @@ async fn main() -> anyhow::Result<()> {
122122
}
123123
}
124124
CliCommand::GetTlsCert { server } => {
125-
let cert_chain = get_tls_cert(server, TdxAttestation).await?;
125+
let cert_chain = get_tls_cert(server, DcapTdxAttestation).await?;
126126
println!("{}", certs_to_pem_string(&cert_chain)?);
127127
}
128128
}

0 commit comments

Comments
 (0)