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

Rename and overhall DNS name types #125

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Rename and overhall DNS name types #125

wants to merge 5 commits into from

Conversation

briansmith
Copy link
Owner

No description provided.

@edevil
Copy link

edevil commented Jul 5, 2020

Is any help needed with this?

@codecov
Copy link

codecov bot commented Dec 29, 2020

Codecov Report

Merging #125 (34b1032) into master (20a064f) will increase coverage by 1.78%.
The diff coverage is 76.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #125      +/-   ##
==========================================
+ Coverage   73.39%   75.17%   +1.78%     
==========================================
  Files          12       12              
  Lines        1368     1434      +66     
==========================================
+ Hits         1004     1078      +74     
+ Misses        364      356       -8     
Impacted Files Coverage Δ
src/webpki.rs 100.00% <ø> (ø)
src/name.rs 41.40% <60.71%> (+4.76%) ⬆️
tests/dns_name_tests.rs 96.00% <97.67%> (+18.22%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20a064f...34b1032. Read the comment docs.

#[cfg(feature = "std")]
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct DnsName(String);
pub type DnsNameBox = DnsName<Box<[u8]>>;
Copy link
Owner Author

Choose a reason for hiding this comment

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

Coming back to this after a long time, I'm not sure why I thought it was important to make it especially convenient to support Box<[u8]>. I think I'll just remove this.

impl From<DnsNameRef<'_>> for DnsName {
fn from(dns_name: DnsNameRef) -> Self {
dns_name.to_owned()
impl DnsNameInput for String {
Copy link
Owner Author

Choose a reason for hiding this comment

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

I think I will try to remove DnsNameInput. It seems like a very heavyweight mechanism for accomplishing something simple.

@@ -167,7 +167,7 @@ impl<'a> EndEntityCert<'a> {
}

/// Verifies that the certificate is valid for the given DNS host name.
pub fn verify_is_valid_for_dns_name(&self, dns_name: DnsNameRef) -> Result<(), Error> {
pub fn verify_is_valid_for_dns_name(&self, dns_name: DnsName<&[u8]>) -> Result<(), Error> {
Copy link
Owner Author

Choose a reason for hiding this comment

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

We should make this generic over the storage type of dns_name.


// XXX: We need more test cases.
#[test]
fn test_dns_name_eq_different_len() {
Copy link
Owner Author

Choose a reason for hiding this comment

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

:sigh: Supporting Hash and PartialEq for DnsName has high cost for the benefit. I'll probably spend more time writing these equality/hash tests than doing all the rest.

Base automatically changed from master to main January 14, 2021 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants