-
Notifications
You must be signed in to change notification settings - Fork 4
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
gtld functionality #70
Conversation
Also, I had forgot to mention that the phone and the fax numbers were missing for roles. I have that working now but is not in this PR. Yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. Big thing is to use the Contact API, and if it doesn't support the data necessary to add whatever feature is needed.
I'll cover the other items from the bullet points in the PR convo.
icann-rdap-cli/src/main.rs
Outdated
@@ -292,6 +292,9 @@ enum OtypeArg { | |||
/// RDAP JSON with extra information. | |||
JsonExtra, | |||
|
|||
/// Global Top Level Domain Output | |||
Gtld, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer this be GtldWhois, which will make the option "gtld-whois" (I think)
icann-rdap-client/src/gtld/mod.rs
Outdated
} | ||
} | ||
|
||
pub trait ToGtld { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know it is a bit wordy, but I think this should be "ToGtldWhois" for code readability.
icann-rdap-client/src/gtld/mod.rs
Outdated
} | ||
|
||
pub trait ToGtld { | ||
fn to_gtld(&self, params: &mut GtldParams) -> String; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as with above, "to_gtld_whois"
icann-rdap-cli/src/query.rs
Outdated
@@ -33,6 +34,9 @@ pub(crate) enum OutputType { | |||
/// Results are output as Pretty RDAP JSON. | |||
PrettyJson, | |||
|
|||
/// Global Top Level Domain Output | |||
Gtld, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though this is a different enum, it should also be "GtldWhois" to avoid confusion with other things that might be gTLD related in the future.
} | ||
|
||
// Where do we move this to? | ||
// capitalize first letter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless you start collecting a lot of these string utilities, just leave it here. There is a strings.rs
under md
but that's because it required a lot of special cases.
for role in roles { | ||
match role.as_str() { | ||
"registrar" => { | ||
if let Some(vcard_array) = &entity.vcard_array { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be more future proof if you used the Contact API with from_vcard (
pub fn from_vcard(vcard_array: &[Value]) -> Option<Contact> { |
"information pertaining to Internet domain names registered by our", | ||
"our customers. By using this service you are agreeing (1) not to use any", | ||
"information presented here for any purpose other than determining", | ||
"ownership of domain names, (2) not to store or reproduce this data in", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is gonna be problematic. Can you change this test file where the data isn't from centralnic but has the same structure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The JSON files are for the tests, which I just finished. It looks like we can't use them so I will remove nic.xyz
] | ||
], | ||
[ | ||
"ISO-3166-1-alpha-2", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you do change this file, this is not the proper way to do this. You can remove this array.
], | ||
[ | ||
"adr", | ||
{}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to represent the country code, this JSON object should be "cc":"US"
.
See https://anewton1998.github.io/rdap_guide/protocol/jcard_and_vcard.html#adr-property
if let Some(roles) = &entity.roles { | ||
for role in roles { | ||
if role.as_str() == "abuse" { | ||
if let Some(vcard_array) = &entity.vcard_array { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another comment about using the Contact API
Addressing the bullet points:
I believe in tests.
Leave it. Seems useful.
If we ever get redacted right, we'll probably display "REDACTED" or something. So just leave it, IMHO.
There are a lot of tedious things in this.
I vote to remove them if the have no value.
I commented in the code review, but with just one helper function it is fine to leave it there. If a bunch of string related helper functions start building up, then we can consider a refactor. The great thing about software is that it is malleable. |
… name to GtldWhois
Removed the CentailNiC test file, added some others, finished the tests, added Role emails and fax, used the Contact API and changed the name to GtldWhois. |
I think |
Done! |
icann-rdap-client/src/gtld/entity.rs
Outdated
.and_then(|orgs| orgs.get(0).cloned()) | ||
.unwrap_or_default(); | ||
|
||
// Contact address and the URL do not parse correctly, use the vcard. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain this comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which URL are we talking about? The update URL of the complaint form should be in a notice, not the vCard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are looking for the unstructured address (that label in adr
), that should be here: https://github.com/icann/icann-rdap/blob/main/icann-rdap-common/src/contact/mod.rs#L167
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can explain/show this on our call but for the Address the short explanation is that the way address is structured in JSON didn't work well with the from_vcard call to PostalAddress builder and the 3rd line of street address ends up in the city and everything is misaligned by one step iirc. The URL is for the Registrars URL did not end up in the contact data structure either. Why they are that way I don't know 🤷
Here is the first pass at a PR, it is ready for comments but not a merge. Here is why:
Code Organization. I'm not sure what you envisioned for how the code is broken out and utilized. We can certainly change it however you want.