Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cas protocol initiate root ca field #235

Merged
merged 3 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rust/cas_client/src/grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,11 +395,13 @@ impl GrpcClient {
host: cas_hostname.clone(),
port: DEFAULT_H2_PORT.into(),
scheme: Scheme::Http.into(),
..Default::default()
},
EndpointConfig {
host: cas_hostname,
port: DEFAULT_PUT_COMPLETE_PORT.into(),
scheme: Scheme::Http.into(),
..Default::default()
},
));
}
Expand Down
2 changes: 1 addition & 1 deletion rust/utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ path = "src/lib.rs"
[dependencies]
tonic = {version = "0.10.2", features = ["tls", "tls-roots", "transport"] }
prost = "0.12.3"
prost-types = "0.9"
prost-types = "0.12.3"
serde = {version = "1.0", features = ["derive"] }
merklehash = { path = "../merklehash"}
xet_error = {path = "../xet_error"}
Expand Down
1 change: 1 addition & 0 deletions rust/utils/proto/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ message EndpointConfig {
string host = 1;
int32 port = 2;
Scheme scheme = 3;
string root_ca_certificate = 4;
}

message InitiateResponse {
Expand Down
4 changes: 3 additions & 1 deletion rust/utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl std::fmt::Display for common::Scheme {

impl std::fmt::Display for common::EndpointConfig {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let common::EndpointConfig { host, port, scheme } = self;
let common::EndpointConfig { host, port, scheme, .. } = self;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work to make things open ended with the structs

let scheme_parsed = common::Scheme::try_from(*scheme).unwrap_or_default();
write!(f, "{scheme_parsed}://{host}:{port}")
}
Expand Down Expand Up @@ -123,6 +123,7 @@ mod tests {
host: host.to_string(),
port,
scheme: common::Scheme::Http.into(),
root_ca_certificate: String::new(),
};

assert_eq!(e1.to_string(), format!("http://{host}:{port}"));
Expand All @@ -131,6 +132,7 @@ mod tests {
host: host.to_string(),
port,
scheme: common::Scheme::Https.into(),
root_ca_certificate: String::from("abcd"),
};

assert_eq!(e2.to_string(), format!("https://{host}:{port}"));
Expand Down