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

Display redacted strings in the client #63

Closed
wants to merge 3 commits into from
Closed
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
80 changes: 80 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 40 additions & 4 deletions icann-rdap-cli/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use tracing::error;
use tracing::info;

use icann_rdap_client::{
md::{MdOptions, MdParams, ToMd},
md::{redacted::replace_redacted_items, MdOptions, MdParams, ToMd},
query::{qtype::QueryType, request::ResponseData},
request::{RequestData, RequestResponse, RequestResponses, SourceType},
};
Expand Down Expand Up @@ -84,7 +84,19 @@ async fn do_domain_query<'a, W: std::io::Write>(
source_host: &source_host,
source_type: SourceType::DomainRegistry,
};
transactions = do_output(processing_params, &req_data, &response, write, transactions)?;
let replaced_rdap = replace_redacted_items(response.rdap.clone());
let replaced_data = ResponseData {
rdap: replaced_rdap,
// copy other fields from `response`
..response.clone()
};
transactions = do_output(
processing_params,
&req_data,
&replaced_data,
write,
transactions,
)?;
let regr_source_host;
let regr_req_data: RequestData;
if let Some(url) = get_related_link(&response.rdap).first() {
Expand Down Expand Up @@ -135,7 +147,19 @@ async fn do_inr_query<'a, W: std::io::Write>(
source_host: &source_host,
source_type: SourceType::RegionalInternetRegistry,
};
transactions = do_output(processing_params, &req_data, &response, write, transactions)?;
let replaced_rdap = replace_redacted_items(response.rdap.clone());
let replaced_data = ResponseData {
rdap: replaced_rdap,
// copy other fields from `response`
..response.clone()
};
transactions = do_output(
processing_params,
&req_data,
&replaced_data,
write,
transactions,
)?;
do_final_output(processing_params, write, transactions)?;
}
Err(error) => return Err(error),
Expand Down Expand Up @@ -169,7 +193,19 @@ async fn do_basic_query<'a, W: std::io::Write>(
source_type: SourceType::UncategorizedRegistry,
}
};
transactions = do_output(processing_params, &req_data, &response, write, transactions)?;
let replaced_rdap = replace_redacted_items(response.rdap.clone());
let replaced_data = ResponseData {
rdap: replaced_rdap,
// copy other fields from `response`
..response.clone()
};
transactions = do_output(
processing_params,
&req_data,
&replaced_data,
write,
transactions,
)?;
do_final_output(processing_params, write, transactions)?;
}
Err(error) => return Err(error),
Expand Down
3 changes: 3 additions & 0 deletions icann-rdap-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ strum.workspace = true
strum_macros.workspace = true
thiserror.workspace = true

jsonpath-rust = "=0.5.0"
jsonpath_lib = "0.3.0"

[dev-dependencies]

# fixture testings
Expand Down
Loading
Loading