@@ -18,26 +18,6 @@ use core::fmt::Write;
1818
1919use crate :: Error ;
2020
21- /// A DNS name that may be either a DNS name identifier presented by a server (which may include
22- /// wildcards), or a DNS name identifier referenced by a client for matching purposes (wildcards
23- /// not permitted).
24- pub enum GeneralDnsNameRef < ' name > {
25- /// a reference to a DNS name that may be used for matching purposes.
26- DnsName ( DnsNameRef < ' name > ) ,
27- /// a reference to a presented DNS name that may include a wildcard.
28- Wildcard ( WildcardDnsNameRef < ' name > ) ,
29- }
30-
31- impl < ' a > GeneralDnsNameRef < ' a > {
32- /// Yields the DNS name as a `&str`.
33- pub fn as_str ( & self ) -> & ' a str {
34- match self {
35- Self :: DnsName ( name) => name. as_str ( ) ,
36- Self :: Wildcard ( name) => name. as_str ( ) ,
37- }
38- }
39- }
40-
4121/// A DNS Name suitable for use in the TLS Server Name Indication (SNI)
4222/// extension and/or for use as the reference hostname for which to verify a
4323/// certificate.
@@ -147,12 +127,12 @@ impl core::fmt::Debug for DnsNameRef<'_> {
147127/// [RFC 5280 Section 7.2]: https://tools.ietf.org/html/rfc5280#section-7.2
148128/// [RFC 6125 Section 4.1]: https://www.rfc-editor.org/rfc/rfc6125#section-4.1
149129#[ derive( Clone , Copy , Eq , PartialEq , Hash ) ]
150- pub struct WildcardDnsNameRef < ' a > ( & ' a [ u8 ] ) ;
130+ pub ( crate ) struct WildcardDnsNameRef < ' a > ( & ' a [ u8 ] ) ;
151131
152132impl < ' a > WildcardDnsNameRef < ' a > {
153133 /// Constructs a `WildcardDnsNameRef` from the given input if the input is a
154134 /// syntactically-valid DNS name.
155- pub fn try_from_ascii ( dns_name : & ' a [ u8 ] ) -> Result < Self , InvalidDnsNameError > {
135+ pub ( crate ) fn try_from_ascii ( dns_name : & ' a [ u8 ] ) -> Result < Self , InvalidDnsNameError > {
156136 if !is_valid_dns_id (
157137 untrusted:: Input :: from ( dns_name) ,
158138 IdRole :: Reference ,
@@ -164,14 +144,8 @@ impl<'a> WildcardDnsNameRef<'a> {
164144 Ok ( Self ( dns_name) )
165145 }
166146
167- /// Constructs a `WildcardDnsNameRef` from the given input if the input is a
168- /// syntactically-valid DNS name.
169- pub fn try_from_ascii_str ( dns_name : & ' a str ) -> Result < Self , InvalidDnsNameError > {
170- Self :: try_from_ascii ( dns_name. as_bytes ( ) )
171- }
172-
173147 /// Yields a reference to the DNS name as a `&str`.
174- pub fn as_str ( & self ) -> & ' a str {
148+ pub ( crate ) fn as_str ( & self ) -> & ' a str {
175149 // The unwrap won't fail because a `WildcardDnsNameRef` is guaranteed to be ASCII and
176150 // ASCII is a subset of UTF-8.
177151 core:: str:: from_utf8 ( self . 0 ) . unwrap ( )
0 commit comments